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?
Does anything else depend on util.jar? If not, then the easiest solution is to add it directly to the StatefulAccountEJB ejb-jar.
Joined: Apr 27, 2003
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!
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):