Please help!
I'm developing a really small EJB3 based application with just a few
Pojos that I create on the client side, transfer them to the server
through a simple stateless session bean and persist the in the
database using OpenJPA. Currently using Glassfish (v1 build b02-p01).
Now, trying to perform this I'm getting an OutOfMemory Exception
while just sending a simple object graph to the server.
When I deploy the ear packaged app the heapsize is shown as normal:
Current: 76.595.200 bytes
High Water Mark: 76.595.200 bytes
Low Water Mark: 0 bytes
Upper Bound: 518.979.584 bytes
When I perform a simple call on a stateless session bean giving some
pojos as parameters the following exception is thrown:
Exception in thread "main" javax.ejb.EJBException: nested exception
is: java.rmi.MarshalException: CORBA MARSHAL 1398079699 Maybe; nested
exception is:
org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack
trace----------
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe
at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.valuehandlerReadExc
eption(ORBUtilSystemException.java:7053)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value
(CDRInputStream_1_0.java:1016)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value
(CDRInputStream.java:259)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl
$14.read(DynamicMethodMarshallerImpl.java:333)
at
com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readA
rguments(DynamicMethodMarshallerImpl.java:393)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke
(ReflectiveTie.java:119)
at
com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch
ToServant(CorbaServerRequestDispatcherImpl.java:650)
at
com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch
(CorbaServerRequestDispatcherImpl.java:193)
at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestReq
uest(CorbaMessageMediatorImpl.java:1705)
at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
(CorbaMessageMediatorImpl.java:1565)
at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput
(CorbaMessageMediatorImpl.java:947)
at
com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callbac
k(RequestMessage_1_2.java:178)
at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
(CorbaMessageMediatorImpl.java:717)
at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch
(SocketOrChannelConnectionImpl.java:473)
at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork
(SocketOrChannelConnectionImpl.java:1270)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl
$WorkerThread.run(ThreadPoolImpl.java:479)
Caused by: java.io.StreamCorruptedException:
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields
(IIOPInputStream.java:2363)
at com.sun.corba.ee.impl.io.IIOPInputStream.defaultReadObjectDelegate
(IIOPInputStream.java:568)
at com.sun.corba.ee.impl.io.InputStreamHook.defaultReadObject
(InputStreamHook.java:183)
at jee.jpa.travel.Hotel.readObject(Hotel.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.corba.ee.impl.io.IIOPInputStream.invokeObjectReader
(IIOPInputStream.java:1692)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectUsingFVD
(IIOPInputStream.java:1546)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject
(IIOPInputStream.java:396)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal
(ValueHandlerImpl.java:329)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue
(ValueHandlerImpl.java:295)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value
(CDRInputStream_1_0.java:1005)
... 14 more
Caused by: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211
completed: Maybe
at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.valuehandlerReadExc
eption(ORBUtilSystemException.java:7053)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value
(CDRInputStream_1_0.java:1016)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value
(CDRInputStream_1_0.java:850)
at
com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interfac
e(CDRInputStream_1_0.java:844)
at
com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interfac
e(CDRInputStream_1_0.java:834)
at
com.sun.corba.ee.impl.encoding.CDRInputStream.read_abstract_interface
(CDRInputStream.java:275)
at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectDelegate
(IIOPInputStream.java:361)
at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectOverride
(IIOPInputStream.java:524)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:342)
at java.util.HashMap.readObject(HashMap.java:1013)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.corba.ee.impl.io.IIOPInputStream.invokeObjectReader
(IIOPInputStream.java:1692)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject
(IIOPInputStream.java:1210)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject
(IIOPInputStream.java:398)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal
(ValueHandlerImpl.java:329)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue
(ValueHandlerImpl.java:295)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value
(CDRInputStream_1_0.java:1005)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value
(CDRInputStream.java:259)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField
(IIOPInputStream.java:1890)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields
(IIOPInputStream.java:2309)
... 27 more
Caused by: java.io.StreamCorruptedException:
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields
(IIOPInputStream.java:2363)
at com.sun.corba.ee.impl.io.IIOPInputStream.defaultReadObjectDelegate
(IIOPInputStream.java:568)
at com.sun.corba.ee.impl.io.InputStreamHook.defaultReadObject
(InputStreamHook.java:183)
at jee.jpa.travel.Room.readObject(Room.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.corba.ee.impl.io.IIOPInputStream.invokeObjectReader
(IIOPInputStream.java:1692)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectUsingFVD
(IIOPInputStream.java:1546)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject
(IIOPInputStream.java:396)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal
(ValueHandlerImpl.java:329)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue
(ValueHandlerImpl.java:295)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value
(CDRInputStream_1_0.java:1005)
... 48 more
Caused by: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211
completed: Maybe
at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.valuehandlerReadExc
eption(ORBUtilSystemException.java:7053)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value
(CDRInputStream_1_0.java:1016)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value
(CDRInputStream.java:259)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField
(IIOPInputStream.java:1890)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields
(IIOPInputStream.java:2309)
... 61 more
Caused by: java.io.StreamCorruptedException: Java heap space
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields
(IIOPInputStream.java:2363)
at com.sun.corba.ee.impl.io.IIOPInputStream.defaultReadObjectDelegate
(IIOPInputStream.java:568)
at com.sun.corba.ee.impl.io.InputStreamHook.defaultReadObject
(InputStreamHook.java:183)
at java.util.LinkedList.readObject(LinkedList.java:765)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.corba.ee.impl.io.IIOPInputStream.invokeObjectReader
(IIOPInputStream.java:1692)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject
(IIOPInputStream.java:1210)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject
(IIOPInputStream.java:398)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal
(ValueHandlerImpl.java:329)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue
(ValueHandlerImpl.java:295)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value
(CDRInputStream_1_0.java:1005)
... 64 more
Caused by: java.lang.OutOfMemoryError: Java heap space
I already tried to increase the heap space via -Xmx Option up to 1500
MBs but that did not help. Also I tried it with Glassfish V2 which
did not helped again.
Some more infos about my machine:
OS: Mac OS X 10.4.9
JVM: 1.5.0_7_164 also tried Java 6 pre release (build 1.6.0-b88-17-
release, mixed mode, sharing)
Some more about the code: the root Object I'm trieing to serialize to
the server is of class:
@Entity
public class Hotel implements Serializable {
private static final long serialVersionUID = -4246047404614577150L;
private String name;
private String description;
private Address address;
private Contact contact;
private Map<Integer, Room> rooms;
public Hotel() {
this.rooms = new HashMap<Integer, Room>();
}
...
rooms looks like
@Entity
@Table(name="ROOM_TABLE")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE) // we use one
table for all subclasses. Disadvantage: properties of subclasses must
be nillable
@DiscriminatorColumn(name="Classname") // set the table column
of the discriminator value
public class Room implements Serializable {
private static final long serialVersionUID = -1547601180616081632L;
private String id;
private Hotel hotel;
private Integer roomNo;
private List<Feature> features = new LinkedList<Feature>();
private int bedCount = 2;
...
and the Feature class looks like
public class Feature implements Serializable {
private static final long serialVersionUID = 3954616380318479784L;
// we use attribute mapping here
private long id;
private String name;
public Feature() {}
public Feature(String name) {
this.name = name;
}
/*
* Some static Helpers that maintain Features, with this approach we
* don't store same features twice in the database
*/
private transient static Map<String, Feature> features = new
HashMap<String, Feature>();
/*
* Returns an already created features if it exists, otherwise
creates one and returns that one
*/
public static Feature getFeature(String name) {
if (features.containsKey(name))
return features.get(name);
Feature feature = new Feature(name);
features.put(name, feature);
return feature;
}
There"s something that amazes me: by marking the features list in the
room class as "transient" everything works fine, with just a little
heap space.
Any Ideas what's going wrong here?
I'm really frustrated with this issue, so any comments a very very
welcome.
Thanks a lot in advance,
Best regards,
Vivian Steller
PS: please tell me if you need some more information on the
(serverside) code or about my system configuration. I'll post it in 5
minutes;)