There is an reccuring issue with my Spring Boot application (using Oracle Java 8, Hibernate and Oracle DB).
I have following error in the logs:
WARN o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions - SQL Error: 1, SQLState: 23000
ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions - ORA-00001: unique constraint (MY_SCHEMA.SYS_C0057302) violated
This constraint (SYS_C0057302) is UUID being UNIQUE. (UUID VARCHAR2(32) NOT NULL UNIQUE)
I cannot provoke this behaviour running it locally (even with load tests) - locally on windows it looks fine, but on RHEL (where it is deployed) problem occurs all the time.
Note that I have dozen more entity classes which all have UUIDs, but only this class is generating such strange duplicates all the time.
No idea how to fix it. Cannot find root cause of this.
Examples of UUIDsand classes used below:
There is a bit of normal UUIDs at the start, but after some time strange and duplicated UUIDs are being created. On 2 different RHEL envs.
Examples of normal UUIDs:
0C34561DD75D422CAD652715DF6C6E75
0CB86A03945040B9886752CC07EB116E
0DAA1A3AF2B5438F8CB9489348A92223
0EAE079E621B4D2B8E8BE445F76B14C9
0FCF05797E7E40DE8D3A9D6A3B44AAE1
12DEBCAB53C94285A4C3FF32C5A0BF8E
132A877F404D44069F78D9B74DD4BDC9
1338A8CE09B14552B78CBAD640A3CF29
136310C44374412FB5B1B8FAF7E35330
Example of strange UUIDs generated by UUID.randomUUID() - 99% of UUIDs are like that, very similiar, with 3 as number that comes up a lot:
33333330333433363333333233333339
33333330333433363333333333333336
33333330333433363333333433333330
33333330333433363333333433333332
33333330333433363333333433333333
33333330333433363333333533333330
33333330333433363333333533333333
33333330333433363333333533333339
33333330333433363333333533343332
33333330333433363333333633333332
33333330333433363333333633333334
33333330333433363333333733333333
33333330333433363333333733343335
33333330333433363333333833333333
33333330333433363333333933333332
TaskEntity class:
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import ----DashboardTaskDto;
import ----SimpleUserDto;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.UUID;
#Getter
#Setter
#NoArgsConstructor
#Entity
#Table(name = "TASK")
#ToString
#EntityListeners(AuditingEntityListener.class)
#Slf4j
class TaskEntity {
#GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TASK_SEQ")
#SequenceGenerator(sequenceName = "TASK_SEQ", allocationSize = 1, name = "TASK_SEQ")
#Id
private Long id;
#Column(name = "KKF")
private String kkf;
#EqualsAndHashCode.Include
private UUID uuid = UUID.randomUUID();
private String customerName;
private String assignedUserName;
private String assignedUserRole;
private int dpd;
private Boolean bgk;
private String courtProceedings;
private String name;
private LocalDateTime dueDate;
private LocalDateTime doneDate;
private BigDecimal totalLiabilities;
private Long issueActivityId;
private String userId;
#Enumerated(EnumType.STRING)
private TaskStatus status;
#CreatedDate
private LocalDateTime created;
#LastModifiedDate
private LocalDateTime modified;
#Builder
public TaskEntity(String kkf, String customerName, String assignedUserName, String assignedUserRole, int dpd, Boolean bgk, String courtProceedings, String name, LocalDateTime dueDate, LocalDateTime doneDate, BigDecimal totalLiabilities, Long issueActivityId, String userId, TaskStatus status, LocalDateTime created, LocalDateTime modified) {
this.kkf = kkf;
this.customerName = customerName;
this.assignedUserName = assignedUserName;
this.assignedUserRole = assignedUserRole;
this.dpd = dpd;
this.bgk = bgk;
this.courtProceedings = courtProceedings;
this.name = name;
this.dueDate = dueDate;
this.doneDate = doneDate;
this.totalLiabilities = totalLiabilities;
this.issueActivityId = issueActivityId;
this.userId = userId;
this.status = status;
this.created = created;
this.modified = modified;
}
Task repository class:
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.repository.Repository;
import org.springframework.lang.Nullable;
import java.util.Optional;
interface TaskRepository extends Repository<TaskEntity, Long> {
TaskEntity save(TaskEntity from);
Optional<TaskEntity> findByIssueActivityId(Long id);
Page<TaskEntity> findAll(#Nullable Specification<TaskEntity> spec, Pageable pageable);
}
TaskCreator used for entity creation/updates:
class TaskCreator {
public TaskEntity from(IssueActivityEntity issueActivityEntity) {
IssueEntity issue = issueActivityEntity.getIssue();
CustomerEntity customer = issue.getCustomer();
UserEntity user = issueActivityEntity.getUser();
return TaskEntity.builder()
.kkf(customer.getKkf())
.customerName(customer.getCompanyName())
.assignedUserName(user.getName())
.assignedUserRole(user.getRole())
.dpd(issue.retrieveMaxDpd())
.bgk(customer.isBgk())
.courtProceedings(customer.getCourtProceedings())
.name(issueActivityEntity.getActivity().getStatus())
.dueDate(issueActivityEntity.getDueDate())
.doneDate(issueActivityEntity.getDoneDate())
.totalLiabilities(customer.getTotalLiabilities())
.issueActivityId(issueActivityEntity.getId())
.status(issueActivityEntity.getStatus())
.userId(user.getId())
.build();
}
TaskEntity updateFrom(final TaskEntity task, final IssueActivityEntity ia) {
IssueEntity issue = ia.getIssue();
CustomerEntity customer = issue.getCustomer();
UserEntity user = ia.getUser();
task.setKkf(customer.getKkf());
task.setCustomerName(customer.getCompanyName());
task.setAssignedUserRole(user.getRole());
task.setDpd(issue.retrieveMaxDpd());
task.setBgk(customer.isBgk());
task.setCourtProceedings(customer.getCourtProceedings());
task.setName(ia.getActivity().getStatus());
task.setDueDate(ia.getDueDate());
task.setDoneDate(ia.getDoneDate());
task.setTotalLiabilities(customer.getTotalLiabilities());
task.setIssueActivityId(ia.getId());
task.setStatus(ia.getStatus());
task.setUserId(user.getId());
return task;
}
}
Update 1:
I tried setting -Djava.security.egd=file:/dev/./urandom but this did not help at all.
Related
I am trying to fetch all the records using JPA findAll. If I run the same query in the terminal, I get some rows as a result, but not through JPA. I tried other answers on stackoverflow, but nothing worked. I tried adding public getters and setters, although which I assume was done by the annotations.
Model class:
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
#Data
#NoArgsConstructor
#AllArgsConstructor
#Getter
#Setter
#ToString
#Entity
#Table(name = "tea")
public class Product {
#Id
#GeneratedValue(generator = "prod_seq", strategy = GenerationType.SEQUENCE)
#SequenceGenerator(name = "prod_seq", sequenceName = "seq_prod", allocationSize = 1, initialValue = 1)
#Column(name = "product_id")
private int productId;
private String name;
#Column(name = "price_per_kg")
private int pricePerKg;
private String type;
#Lob
#Column(length = 2000)
private String description;
#Column(name = "image_url")
private String imageUrl;
private String category;
}
Service class:
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tea.exceptions.ProductNotFoundException;
import com.tea.models.Product;
import com.tea.repository.ProductRepository;
#Service
public class ProductServiceImpl implements ProductService{
#Autowired
ProductRepository productRepository;
#Override
public List<Product> getAll() throws ProductNotFoundException {
return productRepository.findAll();
}
}
Edit: Adding the repository code:
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.tea.models.Product;
public interface ProductRepository extends JpaRepository<Product,Integer >{
#Query("from Product where type like :type ")
List<Product> findByType( String type);
#Query("from Product where type =?2 and category= ?1")
List<Product> findByCategoryAndType(String category, String type);
#Query("from Product where category like :category")
List<Product> findByCategory(String category);
}
I think query should contain alias name for table like Product p and then condition like p.type.
I have a bord class and a bordrow class, meaning a bord has multiple bordrows in a one to many relation. Whenever I do a GET request on /bords I just want every bord model without the datetimes and without the rows, this is why I added lazy fetch and #JsonIgnore. However all attributes are sent on the request. What did I do wrong?
Bord.java:
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
#Table(name = "bords")
#Entity
public class Bord
{
#Id
#GeneratedValue
private int id;
#NotNull
private String name;
private String icon;
private String background;
#DateTimeFormat
#JsonIgnore
private Date created_at;
#DateTimeFormat
#JsonIgnore
private Date updated_at;
#DateTimeFormat
#JsonIgnore
private Date deleted_at;
#OneToMany(mappedBy = "bord", fetch = FetchType.LAZY)
private List<BordRow> bordRows;
public Bord() {
bordRows = new ArrayList<>();
}
}
BordRow.java:
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
#Entity
#Table(name = "bord_rows")
public class BordRow
{
#Id
#GeneratedValue
private int id;
#NotNull
private String title;
#ManyToOne
#JoinColumn(name="bord_id", nullable=false)
#JsonIgnore
private Bord bord;
}
BordController.java:
import com.jordibenck.scrumbords.scrumbords.entity.Bord;
import com.jordibenck.scrumbords.scrumbords.entity.User;
import com.jordibenck.scrumbords.scrumbords.repository.BordRepository;
import com.jordibenck.scrumbords.scrumbords.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
#RestController
#RequestMapping(path = "/bords")
public class BordController
{
#Autowired
private BordRepository repository;
#GetMapping
public Iterable<Bord> findAll() {
return repository.findAll();
}
}
You should use the annotations in your getters. and not your private fields
Hope it helps
You should delete #DateTimeFormat.
#DateTimeFormat has conflict with #JsonIgnore.
Here is the class of the object I am trying to map:
package com.agent.module.entities;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
#Entity
#Getter #Setter #NoArgsConstructor
#Accessors
public class Accommodation {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String location;
#ManyToOne(optional=false, fetch=FetchType.EAGER)
private AccommodationType type;
private String description;
private String name;
#OneToMany(orphanRemoval=true, fetch=FetchType.EAGER)
#Cascade(CascadeType.ALL)
private Set<Document> images;
private Integer capacity;
#ManyToMany(fetch=FetchType.EAGER)
private Set<AdditionalService> additionalServices;
#OneToMany(orphanRemoval=true, fetch=FetchType.EAGER)
#Cascade(CascadeType.ALL)
private Set<PricePlan> pricePlan;
#ManyToOne(optional=false, fetch=FetchType.LAZY)
private Agent agent;
#OneToMany(orphanRemoval=true, mappedBy="accommodation", fetch=FetchType.EAGER)
#Cascade(CascadeType.ALL)
private Set<Restriction> restrictions;
#ManyToOne(fetch=FetchType.EAGER)
private Category category;
#Override
public String toString() {
return "Name: "+name+"\n"+"Agent PIB: "+agent.toString()+"\n";
}
}
And here is my DTO object:
package com.agent.module.dto;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
#Getter #Setter #NoArgsConstructor
#XmlRootElement
public class AccommodationView {
private Long id;
private String location;
private String typeName;
private String description;
private String name;
private List<String> imagesPath;
private Integer capacity;
private List<String> additionalServicesName;
private List<PricePlanView> pricePlan;
private String agentUsername;
private List<RestrictionView> restrictions;
private String categoryName;
#Override
public String toString() {
return "ID: "+id+"\n"+"Type: "+typeName+"\n"+"Description: "+description+"\n"+"Category: "+categoryName+"\n"+"Name: "+name+"\n";
}
}
When I open my Postman and try to get all the Accommodation objects from MySQL database, I actually want to get DTO objects, and in order to do that I am using ModelMapper. But for some reason every time I try to map Accommodation to AccommodationView, I get Null in return. Here is the class where I am trying to perform the mapping:
#RestController
#RequestMapping(value = "/accommodation")
public class AccommodationController {
#Autowired
AccommodationRepo accommodationRepo;
#Autowired
ModelMapper mapper;
#RequestMapping(value="/all",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
#ResponseBody
ResponseEntity<List<AccommodationView>> getAll(){
List<Accommodation> accommodations = accommodationRepo.findAll();
List<AccommodationView> accommodationViewList= new ArrayList<AccommodationView>();
for(Accommodation accommodation : accommodations) {
System.out.println(accommodation);
System.out.println(convertToDto(accommodation));
accommodationViewList.add(convertToDto(accommodation));
}
return new ResponseEntity<List<AccommodationView>>(accommodationViewList, HttpStatus.OK);
}
private AccommodationView convertToDto(Accommodation accommodation) {
return mapper.map(accommodation, AccommodationView.class);
}
private Accommodation convertToEntity(AccommodationView accommodationView) {
return mapper.map(accommodationView, Accommodation.class);
}
}
Here is the output I get when I hit the method:
Name: Test
Agent PIB: 2308995710368
ID: null
Type: null
Description: null
Category: null
Name: null
First part of the output is from Accommodation object, and second part of the output is from AccommodationView object. If anyone has any idea whats going on I would really appreciate the help.
you have to generate public setters functions for the target class, in your case (Accommodation Entity). elsewise the Modelmapper cannot access the private fields of your class to set their values.
I'm having troubles in creating a custom query within spring, because my Entity contains an "_" character in it's parameter's name: "game_date".
My table has a column named "game_date" as well.
I have created following method:
List<Games> findByGame_dateAndOpponent(#Param("game_date") Date game_date, #Param("opponent") String opponent);
but when I start my app, it's crashing with exception of kind: "org.springframework.data.mapping.PropertyReferenceException: No property gamedate found for type Games!". After changing a parameter name to the "gameDate" both in Entity and Query method, it stopped complaining, and is actually returning expected entries. But at the same time, it doesn't return values from the column "game_date", in the search queries, which is a simple regular column of a Date type. I have no idea what's going on with all this thing.
DB I'm using is MySql.
Here comes the code itself:
Entity:
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
#Entity
#Table(name = "games")
public class Games {
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
#Column(name = "id_game")
private int id;
#Column(name = "game_date", columnDefinition = "DATE")
#Temporal(TemporalType.DATE)
private Date gameDate;
public Date getGame_date() {
return gameDate;
}
public void setGame_date(Date _game_date) {
this.gameDate = _game_date;
}
}
And a repository:
import java.sql.Date;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
#RepositoryRestResource
public interface GamesRepository extends CrudRepository< Games , Integer > {
List< Games > findById( #Param( "id" ) int id );
List< Games > findAll( );
List<Games> findByGameDateAndOpponent(#Param("game_date") Date game_date, #Param("opponent") String opponent);
}
The underscore is a reserved keyword in Spring Data JPA. It should be enough to remove it from your property and from its getters and setters and Hibernate will do the rest:
#Entity
#Table(name = "games")
public class Games {
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
#Column(name = "id_game")
private int id;
//Getter and setters for id
#Column(name = "game_date")
private Date gameDate;
public Date getGameDate() {
return gameDate;
}
public void setGameDate(Date gameDate) {
this.gameDate = gameDate;
}
}
Also, in general, try to use java naming convention for variable and field names, which is mixed case with lowercase first.
See also:
Spring Data JPA repository methods don't recognize property names with underscores
I'm using a GlassFish 4.0 server and server-sided JPA-based classes, which I want to deliver via JAX-RS. This works fine so far for simple entities. However, if I have a #OneToMany relation for example AND there is a linked entity, the server returns a 500 internal server error. In that case, nothing is logged to the server log. In order to find the error, I created a small custom JSP page to get more info about what happened. The code is just this:
Status: <%= pageContext.getErrorData().getStatusCode() %>
Throwable: <%= pageContext.getErrorData().getThrowable() %>
Unfortunately, the output is just "Status: 500 Throwable: null"
My own server-sided code seems to run properly (did some debug output), but however, some error emerges. In this example, the User and Issue classes can be retrieved without a problem unless there is a linked IssueComment entity:
User class:
package my.application.model;
import static javax.persistence.FetchType.LAZY;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
/**
* The persistent class for the User database table.
*
*/
#XmlRootElement
#Entity(name="User")
#Table(name="User")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name="id")
private int id;
#Column(name="failedLogin")
private short failedLogin;
#Column(name="firstname")
private String firstname;
#Column(name="lastname")
private String lastname;
#Column(name="middlename")
private String middlename;
#Column(name="password")
private String password;
#Column(name="username")
private String username;
//bi-directional many-to-one association to IssueComment
#OneToMany(mappedBy="user", fetch = LAZY)
private List<IssueComment> issueComments;
//bi-directional many-to-one association to SignalComment
#OneToMany(mappedBy="user", fetch = LAZY)
private List<SignalComment> signalComments;
//bi-directional many-to-one association to SignalMeasure
#OneToMany(mappedBy="user", fetch = LAZY)
private List<SignalMeasure> signalMeasures;
public User() {
}
public int getId() {
return this.id;
}
// more getters and setters auto-generated by Eclipse
}
User class:
package my.application.model;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
#NamedQuery(
name = "getSingleIssue",
query = "SELECT i FROM Issue i WHERE i.id = :id"
)
/**
* The persistent class for the Issue database table.
*
*/
#XmlRootElement
#Entity(name="Issue")
#Table(name="Issue")
public class Issue implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy=GenerationType.IDENTITY)
#Column(name="id")
private int id;
#Column(name="concernedModule")
private String concernedModule;
#Column(name="createdate")
#Temporal(TemporalType.TIMESTAMP)
private Date createdate;
#Column(name="duedate")
#Temporal(TemporalType.TIMESTAMP)
private Date duedate;
#Column(name="priority")
private int priority;
#Column(name="reminderdate")
#Temporal(TemporalType.TIMESTAMP)
private Date reminderdate;
#Column(name="responsibleUserId")
private int responsibleUserId;
#Column(name="sendingModule")
private String sendingModule;
#Column(name="severity")
private int severity;
#Column(name="status")
private int status;
#Column(name="title")
private String title;
// bidirectional many-to-one association to IssueComment
#OneToMany(mappedBy = "issue")
private List<IssueComment> issueComments;
public Issue() {
}
public int getId() {
return this.id;
}
// more getters and setters....
}
IssueComment:
package my.application.model;
import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
/**
* The persistent class for the IssueComment database table.
*
*/
#Entity(name="IssueComment")
#Table(name="IssueComment")
public class IssueComment implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue
#Column(name="id")
private int id;
#Lob
#Column(name="comment")
private String comment;
#Temporal(TemporalType.TIMESTAMP)
#Column(name="time")
private Date time;
//bi-directional many-to-one association to Issue
#ManyToOne(fetch = FetchType.EAGER)
#JoinColumn(name="issueId")
private Issue issue;
//bi-directional many-to-one association to User
#ManyToOne(fetch = FetchType.EAGER)
#JoinColumn(name="userId")
private User user;
public IssueComment() {
}
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
// getters/setters....
}
The Webservice is as follows:
package my.application.server.webservice;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.ext.Provider;
import org.glassfish.jersey.server.ResourceConfig;
import my.application.data.UserStorage;
import my.application.logger.Logger;
import my.application.model.Signal;
import my.application.model.SignalComment;
import my.application.model.User;
#Provider
#Path("User")
public class UserService extends ResourceConfig {
private UserStorage storage = new UserStorage();
public UserService() {
this.packages("my.application.model");
}
#Produces(MediaType.APPLICATION_XML)
#Path("load")
#GET
public User getUser(#QueryParam("id") int id) {
try {
Logger.getInstance().log("fetching id: " + id);
User u = storage.getUser(id);
Logger.getInstance().log("number of signal comments: " + u.getSignalComments().size());
SignalComment sc = u.getSignalComments().get(0);
Logger.getInstance().log("Signal 0 comment: " + sc.getComment());
Signal s = sc.getSignal();
Logger.getInstance().log("Signal subject: " + s.getSubject());
return u;
} catch (Exception e) {
e.printStackTrace();
}
// this code is not being reached (so no errors in this method):
Logger.getInstance().log("---EXCEPTION HAS BEEN THROWN---");
return null;
}
}
I left away the client source code since it's server-sided and can be reproduced with a normal browser, so no necessity for client code here IMHO.
Make sure you don't have any cyclic references in graph (objects) you're trying to marshall to XML. For example, this could cause a problem:
User -> IssueComment -> (the same) User
or
User -> IssueComment -> Issue -> IssueComment -> (the same) User
Such structures cannot be marshalled into XML.
Note: Add #XmlRootElement annotation to IssueComment (I think it's not needed but it's better to have it there).
Note: We know about the logging issue and it will be solved as a part of JERSEY-2000.