Mantis - Resin
Viewing Issue Advanced Details
2118 feature always 10-26-07 09:51 11-01-07 15:07
westrupp  
ferg  
high  
closed 3.1.3  
fixed  
none    
none 3.1.4  
0002118: hessian serialization issue: ArrayList declared as Collection
(rep by Daniel Spangler)

// Bean to be serialized as a parameter to the service below.
@Entity
@Table(name="patient")
public class Patient implements Serializable {
...
   @OneToMany(mappedBy="patient", fetch=FetchType.LAZY)
   private Collection<Order> orders = new ArrayList<Order>();

Serializing a Patient object to an EJB service as a parameter, causes the issue below.

// EJB service
@Stateless
@Local(OrderSubmissionService.class)
public class OrderSubmissionServiceBean implements OrderSubmissionService {

    // service with "Patient" as a parameter
    public Long createOrder(final Patient patient) throws ServiceException {
      ...
    }
}


In the Patient object the "orders" is an ArrayList and the target is java.util.Collection, which should work, but seems to be confusing Hessian for some reason.

[16:19:08.734] FINE com.caucho.hessian.io.SerializerFactory hessian: expected 'java.util.Collection' at ''


More info:

[16:19:08.718] FINE com.caucho.server.http.HttpRequest Http[6] POST /pathwork-webapp-0.1-SNAPSHOT/hessian/ordersubmission HTTP/1.1
[16:19:08.718] FINE com.caucho.server.http.HttpRequest Http[6] Remote-IP: 127.0.0.1:2369
[16:19:08.718] FINE com.caucho.server.http.HttpRequest Http[6] Content-Type: x-application/hessian
[16:19:08.718] FINE com.caucho.server.http.HttpRequest Http[6] User-Agent: Java/1.6.0_02
[16:19:08.718] FINE com.caucho.server.http.HttpRequest Http[6] Host: localhost:8080
[16:19:08.718] FINE com.caucho.server.http.HttpRequest Http[6] Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
[16:19:08.718] FINE com.caucho.server.http.HttpRequest Http[6] Connection: keep-alive
[16:19:08.718] FINE com.caucho.server.http.HttpRequest Http[6] Content-Length: 343
[16:19:08.718] FINE com.caucho.hessian.server.HessianServlet call 1.0
[16:19:08.718]
[16:19:08.718] FINE com.caucho.hessian.server.HessianServlet method "createOrder"
[16:19:08.718]
[16:19:08.718] FINE com.caucho.hessian.server.HessianServlet map com.amirsys.pathwork.entity.Patient(0)
[16:19:08.718]
[16:19:08.718] FINE com.caucho.hessian.server.HessianServlet "id" => null
[16:19:08.718]
[16:19:08.718] FINE com.caucho.hessian.server.HessianServlet "clientProvidedPatientId" => "MyId"
[16:19:08.718]
[16:19:08.718] FINE com.caucho.hessian.server.HessianServlet "firstName" => null
[16:19:08.718]
[16:19:08.718] FINE com.caucho.hessian.server.HessianServlet "lastName" => null
[16:19:08.718]
[16:19:08.718] FINE com.caucho.hessian.server.HessianServlet "ssn" => null
[16:19:08.718]
[16:19:08.718] FINE com.caucho.hessian.server.HessianServlet "nonExistentSSN" => null
[16:19:08.718]
[16:19:08.718] FINE com.caucho.hessian.server.HessianServlet "sex" => null
[16:19:08.718]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "middleInitial" => null
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "homePhone" => null
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "workPhone" => null
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "workExt" => null
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "mobilePhone" => null
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "dob" => null
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "address" => null
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "orders" => list (0000001)
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.io.SerializerFactory hessian: expected 'java.util.Collection' at ''
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet 0: map com.amirsys.pathwork.entity.Order(0000002)
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "id" => null
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "finalDiagnosis" => null
[16:19:08.734]
[16:19:08.734] FINE com.caucho.hessian.server.HessianServlet "patient" => null
[16:19:08.734]

Notes
(0002435)
ferg   
11-01-07 15:07   
jpa/0j70

This is an Amber issue rather than a Hessian one.