Classloader question on invoking EJB from a java class
Joined: Jul 24, 2003
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.
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.
Joined: Jul 18, 2001
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.