-
1. Re: Upgrading 4.0.4 to 4.2.2; problems accessing EJBs
jaikiran Jun 3, 2008 1:24 AM (in response to rdoust)When attempting to get access from the code in one of the two wars to some of the EJBs, I'm getting class cast exceptions, whether I attempt to gain access to remote interfaces (using PortableRemoteObject.narrow()), or local.
Probably a classloader issue. Are you packaging the remote/local interfaces of the bean in more than one place. See this http://wiki.jboss.org/wiki/ClassCastExceptions for debugging the issue. Check the jmx-console method mentioned in that wiki.
The other reason might be that the object returned by the lookup is probably not the bean proxy you are interested in. Follow this wiki http://wiki.jboss.org/wiki/DisplayTheJNDITreeWithTheJMXConsole and check the jndi tree contents. Look for the jndi-name that you are using to do the lookup and see what object is bound to that name. -
2. Re: Upgrading 4.0.4 to 4.2.2; problems accessing EJBs
rdoust Jun 4, 2008 2:34 PM (in response to rdoust)I find the class I'm looking for in the JNDI tree view. It has the proxy name of the class that I also see when in the debugger when I get the instance from the JNDI lookup. In the JNDI tree view it says that it implements the Home Interface that I expect. Yet the cast fails. So, I assume that the problem is multiple copies of the class in the deployment, being seen by different class loaders. I'd like to try to resolve the situation without completely rewriting my build scripts. I looked at the JMImplementation output from displayClassInfo and it tells me that there's only one instance, but I know that I'm deploying the Home interface class in two different places. It's in the ejbjar that contains the implementation of the bean itself, and it's also in the ejb_client.jar that contains the interfaces only. This was my understanding of how to deploy at some point. I've removed it from the ejb_client.jar and am able to get past the class cast exception, but get a linkage error when attempting to invoke a method on the instance, although I'm able to create the instance with no problem.
The ejb.jar is deployed directly in the ear, and the ejb_client.jar is in the WEB-INF/lib directory of the war.
Should I move the interfaces to a separate jar file and put it into a new lib directory in the ear, which will then be available to both the implementation in the ejb-jar (having been removed from there) as well as the classes in the war? It seems to me that this is the new deployment mechanism, made possible by J2EE 5.0. Have I got that right? -
3. Re: Upgrading 4.0.4 to 4.2.2; problems accessing EJBs
jaikiran Jun 5, 2008 1:01 PM (in response to rdoust)If the classes are needed by both the war and the ejb component (like in this case), then you can package them in a jar and place that jar under the lib folder of the EAR. Those jars will by default be added to the classpath of the application.
-
4. Re: Upgrading 4.0.4 to 4.2.2; problems accessing EJBs
jaikiran Jun 5, 2008 1:02 PM (in response to rdoust)"jaikiran" wrote:
If the classes are needed by both the war and the ejb component (like in this case), then you can package them in a jar and place that jar under the lib folder of the EAR. Those jars will by default be added to the classpath of the application.
And yes, this is available in 4.2.x.