aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes ejb depend on third-party library and Class-Path entry!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ejb depend on third-party library and Class-Path entry!!!" Watch "ejb depend on third-party library and Class-Path entry!!!" New topic
Author

ejb depend on third-party library and Class-Path entry!!!

wei wu
Greenhorn

Joined: Apr 27, 2003
Posts: 23
I wrote a simple enterprise application:
wwlhpApp.ear
|___StatefulAccountEJB.jar
|___webModule.war
|___lib
| |___util.jar
|___META-INF
|___application.xml
|___manifest.mf
and StatefulAccountEJB.jar depends on util.jar, so I add a Class-Path entry in its manifest.mf which is like this:
but when I deploy this app on weblogic6.1, it thrown exception:
java.io.IOException: invalid manifest format
at java.util.jar.Manifest.read(Unknown Source)
at java.util.jar.Manifest.<init>(Unknown Source)
at java.util.jar.JarFile.getManifest(Unknown Source)
at java.util.jar.JarFile.getInputStream(Unknown Source)
at weblogic.utils.jars.VirtualJarFile.getInputStream(VirtualJarFile.java
:130)
at weblogic.ejb20.dd.xml.DDUtils.getEntry(DDUtils.java:395)
at weblogic.ejb20.dd.xml.DDUtils.getEjbJarXml(DDUtils.java:285)
at weblogic.ejb20.dd.xml.DDUtils.loadEJBJarDescriptorFromJarFile(DDUtils
.java:182)
at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.jav
a:157)
at weblogic.ejb20.deployer.Deployer.createEJBDescriptor(Deployer.java:74
2)
at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:851)
at weblogic.j2ee.EJBComponent.deploy(EJBComponent.java:33)
at weblogic.j2ee.Application.deploy(Application.java:262)
at weblogic.j2ee.J2EEService.deployApplication(J2EEService.java:191)
The exception complains the format of ejb's manifest file is not correct.
What is the problem?
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Does anything else depend on util.jar? If not, then the easiest solution is to add it directly to the StatefulAccountEJB ejb-jar.
wei wu
Greenhorn

Joined: Apr 27, 2003
Posts: 23
yes, i know this approach. but this solution is not a graceful one.
Suppose you have a large application which has lots of common utility classes. Are u going to put all these classes into ejb-jar? I think this will dirty ejb-jar.I prefer extracting these classes out from ejb-jars and put them into lib directory which is referenced by Class-Path entries in manifest files of ejb-jars.
I'm very grateful if someone can explain the correct manifest file format!
Ryan Fernandes
Ranch Hand

Joined: Dec 11, 2003
Posts: 86
Hi Wei,
Here's something I came across that might help you:

In first line of the manifest file, you must always include the Manifest-Version attribute, followed by a new line (CR | LF |CRLF) and then the Class-Path attribute. More information about the manifest format can be found at: http://java.sun.com/j2se/1.4/docs/guide/jar/jar.html#JAR
The manifest Class-Path entries refer to other archives relative to the current archive in which these entries are defined. This structure allows multiple WAR files and EJB JAR files to share a common library JAR. For example, if a WAR file contains a manifest entry of y.jar, this entry should be next to the WAR file (not within it):

Why don't you try something like:

Manifest-Version: 1.0 [CRLF]
Class-Path: lib/util.jar [CRLF]


Unthinking respect for authority is the greatest enemy of truth. -Albert Einstein, physicist, Nobel laureate (1879-1955)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ejb depend on third-party library and Class-Path entry!!!