wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Can I place jar files inside ejb-jar.jar? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can I place jar files inside ejb-jar.jar?" Watch "Can I place jar files inside ejb-jar.jar?" New topic
Author

Can I place jar files inside ejb-jar.jar?

Will McQueen
Greenhorn

Joined: Mar 13, 2005
Posts: 2
Hi,

I'm reading about the packaging rules for creating an ejb-jar.jar file, and I'm wondering whether it's possible to include a jar file (containing helper classes) inside of the ejb-jar file. A "lib" dir (for containing such helper jars) doesn't seem to be part of the ejb-jar file format.

The EJB 3 spec has this to say (Ch 20, "Enterprise JavaBeans 3.0, Final Release):
"The ejb-jar file must also contain, either by inclusion or by reference, the class files for all the classes and interfaces that each enterprise bean class and the home interfaces, component interfaces, and/or web service endpoints depend on, except Java EE and J2SE classes. This includes their superclasses and superinterfaces, dependent classes, and the classes and interfaces used as method parameters, results, and exceptions"

Now, it seems that the root of the the ejb-jar file contains all the classes (in the appropriate Java package layout). But what about including JAR files? The ejb-jar spec seems to have nothing to say about a "lib" dir that can contain jars (as a WAR file can).

Summary of questions:
1) Can an ejb-jar file contain a jar file? If so, how/where?
2) Can the ejb-jar file's META-INF/MANIFEST.MF file contain a reference to a JAR file?

I'm not considering correct design at the point... I'd just like to know if these 2 scenarios are possible.

Thank you!
Will
Abhinav Srivastava
Ranch Hand

Joined: Nov 19, 2002
Posts: 349

option 2 is possible.
Bronwyn Cook
Greenhorn

Joined: Jan 23, 2008
Posts: 1
I'm not sure that you can reference jars within the jar in the MANIFEST file:

http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html

"Note : The Class-Path header points to classes or JAR files on the local network, not JAR files within the JAR file or classes accessible over internet protocols. To load classes in JAR files within a JAR file into the class path, you must write custom code to load those classes. For example, if MyJar.jar contains another JAR file called MyUtils.jar, you cannot use the Class-Path header in MyJar.jar's manifest to load classes in MyUtils.jar into the class path. "
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I place jar files inside ejb-jar.jar?
 
Similar Threads
EJB3.0 & calling remote interface.
how to jar ejb in this case
class package directories in $JAVAHOME\jre\lib\ext
About ejb-jar file
ejb-jar file 's content