[jboss-dev-forums] [EJB Development] New message: "Problem in sar and ear class loading"

simulex inc do-not-reply at jboss.com
Tue Feb 2 18:18:26 EST 2010


JBoss development,

A new message was posted in the thread "Problem in sar and ear class loading":

http://community.jboss.org/message/523805#523805

Author  : simulex inc
Profile : http://community.jboss.org/people/simulex

Message:
--------------------------------------------------------------
I have ejb[UserBean] which saves the user details to the database. The EJB project is dependent on hibernate and I had to provide its own class-loader in jboss-web.xml. [UserData.ear]
 
I want to invoke this bean when the user logs in to the JBoss Portal.For this I created a Listener and registered it using jboss-service.xml. The class (UserLoginEventListener) implements PortalEventListener and listens for the UserAuthenticationEvent. I have the jar for the ejb in the lib folder sar/lib. [LoginEvent.sar]
 
When I try to invoke the ejb from UserLoginEventListener, I get the ClassCastException. I understand this is because the UserBean is loaded by two class-loaders(one from the .ear and other from .sar) . If I try to remove the ejb jar (expecting that it will find the bean class from ear loader) I get NoClassDefFoundError.
 
In the jboss-service.xml(for .sar), if I specify class-loader, then it fails to deploy the sar as now it doenst find JBossServiceModelMBean class which is required to register the service.
 
Is there a way that I can share the class-loader for .sar and for .ear so that the ejb class will be loaded only once avoiding ClassCastException? Or is there a better way to do it?
 
Thanks.

 
 
 
 
 

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/523805#523805




More information about the jboss-dev-forums mailing list