File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
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

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

wei wu

Joined: Apr 27, 2003
Posts: 23
I wrote a simple enterprise application:
| |___util.jar
and StatefulAccountEJB.jar depends on util.jar, so I add a Class-Path entry in its which is like this:
but when I deploy this app on weblogic6.1, it thrown exception: invalid manifest format
at 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(
at weblogic.ejb20.dd.xml.DDUtils.getEntry(
at weblogic.ejb20.dd.xml.DDUtils.getEjbJarXml(
at weblogic.ejb20.dd.xml.DDUtils.loadEJBJarDescriptorFromJarFile(DDUtils
at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.jav
at weblogic.ejb20.deployer.Deployer.createEJBDescriptor(
at weblogic.ejb20.deployer.Deployer.deploy(
at weblogic.j2ee.EJBComponent.deploy(
at weblogic.j2ee.Application.deploy(
at weblogic.j2ee.J2EEService.deployApplication(
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

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:
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)
jQuery in Action, 2nd edition
subject: ejb depend on third-party library and Class-Path entry!!!