users@glassfish.java.net

WAR, EJB and List as a method argument

From: <glassfish_at_javadesktop.org>
Date: Tue, 17 Mar 2009 15:29:41 PDT

Hi everybody,

I'm developing a simple j2ee application, that consists of one EJB and one webapplication. Both of these are deployed on the glassfish application server. For several reasons I cannot put both modules into the EAR application, but I have to deploy them as individual modules.

For this reason I have put the EJB jar file also into the WEB-INF/lib of the web application. Everything works fine in this scenario apart from one case. I will illustrate this rather on an example.

I have defined a simple method in my EJB (OrderDAOImpl that implemets OrderRemote and OrderLocal interfaces):
void doSomething(List<Product> list){
....do something
}
where Product is a class defined in the EJB jar archive

when I try to call this method in the webapplication:
orderDAO = (OrderRemote) ic.lookup("orderDAO");
List<Product> list = new ArrayList<Product>();
list.add(new Product());
orderDAO.doSomething(list);

i get an exception:
WARNING: "IOP00810257: (MARSHAL) Could not load class sk.miroz.ejb.model.Product"
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9679)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9694)
 ... stacktrace continues...

exception is thrown before the implementation of doSomething methos is entered. It seem like the there is a problem with serialization/deserialization/classloading of the ArrayList. Cannot it be caused because webapplication and EJB use different classloaders (WebappClassLoader and EJBClassLoader)? Is it possible to set, that both - the web application and also ejb use the same classloader?

when I modified the function:
void doSomething(Product product){
....do something
}
everything worked.

Thanks in advance,
   Marian
[Message sent by forum member 'mirozet' (mirozet)]

http://forums.java.net/jive/thread.jspa?messageID=337545