aspose file tools*
The moose likes BEA/Weblogic and the fly likes Classloader question on invoking EJB from a java class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Classloader question on invoking EJB from a java class" Watch "Classloader question on invoking EJB from a java class" New topic
Author

Classloader question on invoking EJB from a java class

Padam Krishna
Ranch Hand

Joined: Jul 24, 2003
Posts: 37
Description
I am using WL 7.0 and added a start up class for my managed server in the admin console and required jar in the java -classpath at the managed server startup.
I have an EAR file, which is hot-deployed and targetted to the same managed server.
Question
The start up class invokes when i start the managed server and create the home and remote interface for the EJB without any problems, but I am having difficuly in understanding how is this happening.
The java class is in a different (parent) classloader and EAR is in a (child) classloader so how my java class is able to get the remote interface of the ejb as I don't have ejb-client jar in my classpath. I am using reflection to invoke the create method on the ejb home interface.
Can any one please help me with this.
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Hi,
u may find this links useful:
weblogic 7.0 classloading
WL Server LifeCycle
Padam Krishna
Ranch Hand

Joined: Jul 24, 2003
Posts: 37
I have gone thru all these document but its not clearly mentioned any where or I might have missed out something.
Can any one encountered the scenario I mentioned in my earlier post.
Search on google groups for "start up class ejb" brings lot of pages, but none has sufficient explaination on this.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
You will need to package the home and remote interfaces of your ejb with the startup classes. Unfortunately this means that those classes will be on the System classpath and therefore will negatively affect dynamic reloading. Your other choice is to not directly call your ejbs and instead invoke them thru the use of an MDB. This would just require your Startup Class to drop a JMS message. Of course this may or may not work in your particular situation, though personally I have found it very useful to decouple various pieces of an application this way.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Classloader question on invoking EJB from a java class