EJB programming & troubleshooting: EJB JAR problem!?
I work with EJB for a long time, and find that the classes that the Beans want to use must be contained in the same Bean's jar.Is this right?
And i think that the Bean's JAR should only contain the Bean Classes and nothing else.Should i set the proper classpath when i compile the Bean's Classes and package them?Thus the JAR maybe not contain the No-Bean's Classes.
hope give me some advice:)3ks
In our project we generally take 2 different approaches.
1> If the classes are very specific to that bean itself and not used by any other bean then we package it with the bean (i.e in EJB jar).
2> If the classes are shared by different beans , then we put the classes separately ( may be in a separate jar file or directly in package structure in some directory)and give the classpath when the server starts up. Because I think it is not a good idea to include the classes in every jar which are shared.
But for any cases I think option 2 is possible.
(2) would work for app server cold start. but if one wants to do hot deploy of EJB jar w/ external JAR libraries, is there any way?
Where can i download ejb.jar?
but if one wants to do hot deploy of EJB jar w/ external JAR libraries, is there any way?
You can always use an EAR file, containing EVERYTHING, from your own jars and third party libraries.
Of course, in that case you must propertly generate manisfest files for each jar...