Class-path manifest attribute

Hi,
I have a session bean, that references some external classes. I am deploying the
application as a ear file. The session beans are stored in a jar file and the
external classes are stored in a separate jar file. Both the jar files go into
an ear file. The manifest of the session bean jar file defines the relative URI
of the other jar file using the Class-path attrtibute. I use JDK 1.3.1. However,
when I try to deploy the ear, WLS complains about not being able to find the extermal
class. I use WLS 6.1. This is driving me nuts, any help would be highly appreciated.
I have attached the EAR file.
Thanks
Meeraj

I was wondering as to why was this constraint placed on EJB's in
weblogic(that Class-Path can't be used in manifest). After all EJB jar is
also a jar file, and as what java extensions mechanism dictates, any jar
file can utilize this feature.
and how the code would the loadClass/findClass method in the classloader
look like of I were to disable this feature (like what weblogic currently
behaves....)
any thoughts!!!
- Rajeev Dave
"Deepak Vohra" <[email protected]> wrote in message
news:[email protected]...
Manifest Class-Path
Use the manifest file to specify that a JAR file can reference another JARfile.
Standalone EJBs cannot use the Manifest Class-Path. It is only supportedfor
components that are deployed within an EAR file.
To use the manifest file to reference another JAR file:
Specify the name of the referenced JAR file in a Class-Path header in the
referencing JAR file's Manifest file.
The referenced JAR file is named using a URL relative to the URL of the
referencing JAR file.
Name the manifest file META-INF/MANIFEST.MF in the JAR file
The Class-Path entry in the Manifest file is as follows:
Class-Path: AAyy.jar BByy.jar CCyy.jar.
Meeraj wrote:
Hi,
That is not what I want to do. I had got similar stuff working fine with
JBoss
by resolving dependencies using Class-path manifest attribute.
Thanks
Meeraj
Deepak Vohra <[email protected]> wrote:
Add the external classes to the Sessions Bean jar.
Meeraj Kunnumpurath wrote:
Hi,
I have a session bean, that references some external classes. I amdeploying the
application as a ear file. The session beans are stored in a jar fileand the
external classes are stored in a separate jar file. Both the jar
files
go into
an ear file. The manifest of the session bean jar file defines therelative URI
of the other jar file using the Class-path attrtibute. I use JDK
1.3.1.
However,
when I try to deploy the ear, WLS complains about not being able tofind the extermal
class. I use WLS 6.1. This is driving me nuts, any help would be
highly
appreciated.
I have attached the EAR file.
Thanks
Meeraj

Similar Messages

  • Jar: Manifest-Attribute "Class-Path"

    I've got a problem with the Class-Path-attribute of the JARs manifest-file. So I've written a real simple application to test where the problems occure... but even this trivial app does not work!
    The execution starts at "Starter.java":
    public class Starter{
          public static void main(String args[]){
                packageOne.Caller.callWriter();
    }The class "Caller" is in a JAR ("Caller.jar") in the same directory as Starter.java.
    Caller.java:
    package packageOne;
    public class Caller{
          public static void callWriter(){
                packageTwo.Writer.write("Write this");
    }The class "Writer" is in a JAR ("Writer.jar") in the same directory as Starter.java and Caller.jar.
    Writer.java:
    package packageTwo;
    public class Writer{
          public static void write(String message){
                System.out.println(message);
    }The file Caller.jar consists of Caller.class and the Manifest.mf. The package-structur/the path seams to be all right.
    The file Writer.jar consists of Writer.class and the Manifest.mf. The package-structur/the path seams to be all right.
    If I invoke the Starter with:
    java Starter -classpath Caller.jar;Writer.jareverything's fine.
    Now, I added the following line to the Manifest.mf of Caller.jar:
    Class-Path: Writer.jar(with one empty line between Manifest-Version: 1.0 and the new line.
    So... shouldn't it be possible now, to invoke the application with:
    java Starter -classpath Caller.jar ???
    It doesn't work. So: what have I misunderstood?
    (The error message is:
    Exception in thread "main" java.lang.NoClassDefFoundError: packageTwo/Writer
          at packageOne.Caller.callWriter(packageOne/Caller.java:5)
          at Starter.main(Starter.java:3)

    Hmmm, I tested it and here are the command I ran and their results. Try doing the same on your computer:aleph% mkdir packageOne
    aleph% mkdir packageTwoThat created the directories.aleph% cat > Starter.java
    public class Starter{
          public static void main(String args[]){
                packageOne.Caller.callWriter();
    aleph% cat > packageOne/Caller.java
    package packageOne;
    public class Caller{
          public static void callWriter(){
                packageTwo.Writer.write("Write this");
    aleph% cat > packageTwo/Writer.java
    package packageTwo;
    public class Writer{
          public static void write(String message){
                System.out.println(message);
    }That created the source files: Starter.java in the current directory, Caller.java under packageOne and Writer.java under packageTwo. Next the compiling and creating the manifest file:aleph% javac Starter.java
    aleph% cat > MF
    Class-Path: Writer.jarThat created additional info to be included in manifest file and put it in a file called MF.
    Then I package "caller.jar" with the manifest and "Writer.jar" without it:aleph% jar -cmf MF caller.jar packageOne
    aleph% jar -cf Writer.jar packageTwoDelete the package* directories so java wont get confused...aleph% rm -r package*And finally run the thing. Remember that the path separator is : in unix but ; in DOS, if that is what you are using.aleph% java -cp .:caller.jar Starter
    Write thisNo problems anywhere. What are the steps you did?

  • Who knows about Jar/Manifest: Class-Path-Attribute

    My question is:
    When packaging my classes and ressource files into a jar file, everything works fine as long as I put the manifest-file into the parent directory of the package folders (there's the main class too) and set its Class-Path-Attribut just as . (a dot).
    I'm working with WinXP Prof.
    As soon as I fill in a path with backslashes or slashes as separator, the produced jar-file doesn't work (class loader does'nt find main-class).
    Is the problem the drive-letter (D:) in the path or do you know something else?
    Greetings
    Frank

    Yes, and likely the . is what you need ...saying: I want the packages which begin in the same directory as the jar running this application. Even if your class is in a package hierarchy like tst.test.Support.class, if the directory tst is in the same directory as the application jar, you would use classpath . not tst/test/Support.class. If you put the tst package in a directory under the folder where the jar resides, say called testit ...you would then have a classpath in the mainifest like testit/. The class path always needs to get you to the root of any package you want to use ...but not into the package itself. Java recognizes when it is looking at a package nesting due to the package declaration syntax in the files, the classpath just points to the location of the root of that package and nothing more. Does this make sense?

  • Manifest attribute Class-Path

    Hi !!
    I can't get the Class-Path attribute to function properbly, what i'm trying to do is to include all the jar files my application uses, in one jar file. Where the resources is specified in the Class-Path attribute.
    But the Classloader, can't find any of the resouces specified in the Class-Path attribute.
    Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom/JDOMException
    I'm running on a Windows 2000 with the following java version:
    Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
    My commandline; java -cp: mh-app.jar dk.wavetech.mh.MH
    mh-app.jar has the following structure
    dk/wavetech/mh/MH.class
    lib/jdom.jar
    lib/xerces.jar
    lib/jms.jar
    lib/log4j.jar
    meta-inf/manifest.mf
    My Manifest looks like this.
    Manifest-Version: 1.0
    Created-By: Ant 1.4.5
    Class-Path: lib/log4j.jar lib/jms.jar lib/xerces.jar lib/jdom.jar
    best regards,
    Thomas Engelschmidt

    Hi,
    If you are going to run a JAR file and make use of the classpath in your Manifest-file you need to do like this:
    java -jar mh-app.jar
    You also need to include your main class (starting class) in the Manifest file. like this:
    Main-Class: Application
    That's it!
    /Michael

  • "Failed to load main class manifest attribute from " directory path

    i get this error when trying to run a jar file i made with eclipse. does anyone know how to fix it? thanks derek
    "Failed to load main class manifest attribute from "<directory path>

    A JAR file is simply a collection of class files, in order to make it an "executable" JAR file you must specify which class file is the "main" class file. In other words, which class should the runtime start executing first. You do this using what is called a manifest file, this is meta information included into the JAR file that the runtime extracts and uses. One attribute is the Main-Class key, which specifies the application's entry point.
    The Java tutorial goes into further detail on how to do this
    http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html
    You may also do this using Eclipse by going File -> Export -> Java -> JAR and follow the wizard.
    Using Netbeans this almost comes for free.

  • Help: manifest class path attribute - OC4J 9.0.3

    I have tried everything I can think of. I have even downloaded the developers version of JRun to ensure my code does deploy under the J2EE spec.
    Per compleating deployment under JRun, I have migrated back to OC4J and made the approperate modifications to orion-web.xml to include the following entry:
    <web-app-class-laoder include-manifest-class-path="true" />
    Even with this entry I get the same class not found statements. I am out of ideas.
    Anyone got some sugestions?
    Info: Ear deployment, static pages deploy under all wars...
    Thanks.
    Andrew
    [email protected]

    I have tried everything I can think of. I have even downloaded the developers version of JRun to ensure my code does deploy under the J2EE spec.
    Per compleating deployment under JRun, I have migrated back to OC4J and made the approperate modifications to orion-web.xml to include the following entry:
    <web-app-class-laoder include-manifest-class-path="true" />
    Even with this entry I get the same class not found statements. I am out of ideas.
    Anyone got some sugestions?
    Info: Ear deployment, static pages deploy under all wars...
    Thanks.
    Andrew
    [email protected]
    Hi Andy -
    Can you check the attribute and make sure it's the following:
    <web web-app-class-loader include-war-manifest-class-path="true"/>
    ^^^
    You have have just typed it in quickly, but I noticed there's a typo in the entry you have above and you are missing the WAR piece of the attribute name.
    There's a how-to document on OTN which has an example of this.
    http://otn.oracle.com/tech/java/oc4j/htdocs/how-to-servlet-warmanifest.html
    cheers
    -steve- Hi Steve
    Where can I find the zip file I went through the link but doesn't have any link to zip file
    Thanks
    Ritesh

  • Java 5.0 does not recognize wrapped Class-Path in Manifest.MF of .jar file?

    Java: build 1.5.0_05-b05
    Ant: 1.6.2
    I use Ant <jar> task to create a standalone application in a .jar file. I have a very long "Class-Path" in the Manifest.MF file. The long Class-Path is wrapped at every 70th character by the <jar> task. I cannot run "java -jar <the jar file>", because Java runtime cannot find classes.
    I found the following Q&A from ANT's FAQ page,
    Q: Whenever I use the Ant jar or manifest related tasks, long lines in my manifest are wrapped at 70 characters and the resulting jar does not work in my application server. Why does Ant do this?
    A: Ant implements the Java Jar file specification. Please refer to the notes section where it discusses the maximum allowable length of a line and the concept of continuation characters.
    If a jar file produced by Ant does not work in your appserver, and that failure is due to the wrapped manifest, then you need to consult your appserver provider, as it is a bug in their appserver. Far more likely, however, is a problem in your specification of your classpath. It is not Ant's wrapping of your classpath that is the problem.
    Do not raise a bug about this issue until you have checked to ensure that the problem is not due to your classpath specification.
    Any idea?

    "will be searched ALSO."...
    From: http://java.sun.com/docs/books/tutorial/ext/basics/load.html
    Understanding Extension Class Loading
    The extension framework makes use of the new class-loading mechanism in the JavaTM 1.2 platform. When the runtime environment needs to load a new class for an application, it looks for the class in the following locations, in order:
    1. Bootstrap classes: the runtime classes in rt.jar and internationalization classes in i18n.jar.
    2. Installed extensions: classes in JAR files in the lib/ext directory of the JRE.
    3. The class path: classes, including classes in JAR files, on paths specified by the system property java.class.path. If a JAR file on the class path has a manifest with the Class-Path attribute, JAR files specified by the Class-Path attribute will be searched also.
    [snip]

  • Alternate drives in Jar file Class-Path attribute

    Hello, all. I am working on a project that I would like to package into a single jar file for simple execution. At my place of work classes from EJB are stored on a different drive from where I am doing the development. I am having trouble accessing those classes from the Jars I am creating. When I try the following manifest:
    Main-Class: MyPackage.MyClass
    Class-Path: U:\someFolder
    the application will not start, saying that MyPackage.MyClass cannot be found. This is despite MyPackage.MyClass being properly packaged into the Jar file, as verified by a jar t operation. When I leave off the drive letter in the Class-Path attribute:
    Main-Class: MyPackage.MyClass
    Class-Path: someFolder
    the application starts and executes properly right up until a class from someFolder is needed, at which point exceptions begin to be thrown.
    Any ideas will be much appreciated!
    John Todd

    I was eventually able to find the answer to my own question: Jars do not accept absolute paths at all, only relative paths. Thus, the alternate drive approach will not work. Fortunately I was able to find an alternate solution.
    John Todd

  • Multiple Class-Path: attributes in Jar files

    Hello,
    I'm packaging a set of jar files for distribution with Class-Path: attributes in them. In the documentation I read and in one of the java trails it said that I could have a manifest file like:
    Class-Path: log4j.jar log4j-core.jar
    Class-Path: jsse.jar jcert.jar jnet.jar
    But this doesn't work. It only works when I do this:
    Class-Path: log4j.jar log4j-core.jar jsse.jar jcert.jar jnet.jar
    Here is how I'm running the jar:
    java -jar server.jar
    Is the documentation wrong? Or this is a bug?
    thanks
    charlie

    Certain attributes were only meant to be specified once. Like Main-Class and Class-Path for example. If these were listed two or more times, then the last occurance is the one that gets recognized (basically, each new instance overwrites the previous instance). Some attributes are listed as "per-entry" and are freely duplicated for each entry. For example signed jars could have a number of Name: and xxx-Digest: attributes.
    This link is to the manifest spec:
    http://java.sun.com/products/jdk/1.2/docs/guide/jar/manifest.html
    To answer the original posters question, the doc's are in error. Actually, the error was not in the docs, it was in the tutorial, but none the less its still in error. He could have done this:
    Class-Path: log4j.jar log4j-core.jar
    jsse.jar jcert.jar jnet.jar
    ^-- two spaces before the start of jsse.jar
    because the docs allow for line continuation (although it's not exactly clear if you read the docs). The docs are also apparently in error regarding the max line length of 72 bytes. I have tested this with over 100 char's on a win32 machine and it works fine for me. The limitation must therefore apply to some other operating system, or it could just be in error.
    -Ron

  • How to use Class-Path in Manifest file

    hi,
    I want to add jar files in another executable jar file but the Class-Path in Manifest file is not set correctly,please give an example for setting a Class-Path attribute in Manifest class.
    regards,
    selvaraj

    You looked into the Jar section of the Sun tutorial did you?

  • Jar Class-Path attribute configuration problems

    java version 1.5.0_14
    OS: Windows Server 2003
    Problem description: Executable jar file needs to access external jar file resources on the same server that executable jar file resides.
    Scenario: Executable jar file resides in a directory called c:\Java. External jar file resides in a directory called c:\Java\itext1
    I have attempted configuring the Class-Path attribute in the manifest with the following:
    java/itext1/itext1.jar or entering itext1/itext1.jar
    I receive the following error message, from the java command:
    c:\>java -jar /java/MyJar.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: com/lowagie/text/pdf/
    BaseFont
    I even unpacked the jar file, to see if I could access the class using the following command below (The class does not have a main method, so I did not expect it to execute, but I would have thought the class would have been located)
    C:\>java java/itext1/com/lowagie/tools/BaseFont
    Exception in thread "main" java.lang.NoClassDefFoundError: java/itext1/com/lowa
    ie/tools/BaseFont
    I am at my wit's end. Does anyone have any suggestions?

    The -jar flag tells the interpreter that the application is packaged in the JAR file format, and to my knowledge, has nothing to do with the classpath attribute within the manifest
    At any rate, I found my problem. When packaging the jar via Eclipse, I had 2 .classpath resource files within the project, which was causing the jar fiile to be built incorrectly.

  • Why Failed to load Main-Class manifest attribute

    Why unable to access jarfile coherence.jar?
    Before edit the coherence-cache-config.xml file, I can start a management Coherence cache server using the following command. Then I unpack the coherence.jar file (in %coherence_home%\lib directory) and edit the default cache config file coherence-cache-config.xml, then pack the coherence.jar fie using the following command:
    cd %coherence_home%\lib\coherence
    %java_home%\bin\jar cvf coherence.jar *The coherence.jar is created. But when I rerun the following command to start a management cache server I get a error message.
    What is the conrect way ro repack the coherence.jar file?
    Can I unpack and edit the configuration files?
    F:\coherence\lib>java -Dcom.sun.management.jmxremote -Dtangosol.coherence.management=all -Dtangosol.
    coherence.management.remote=true -jar coherence.jar
    Failed to load Main-Class manifest attribute from
    coherence.jarBut I can start a start a non-management cache server or cache client using the new coherence.jar file.
    It is very strange. Can anyone explain it?
    Edited by: qkc on Dec 24, 2009 12:02 PM
    Edited by: qkc on Dec 24, 2009 1:13 PM

    qkc wrote:
    Why unable to access jarfile coherence.jar?
    Before edit the coherence-cache-config.xml file, I can start a management Coherence cache server using the following command. Then I unpack the coherence.jar file (in %coherence_home%\lib directory) and edit the default cache config file coherence-cache-config.xml, then pack the coherence.jar fie using the following command:
    cd %coherence_home%\lib\coherence
    %java_home%\bin\jar cvf coherence.jar *The coherence.jar is created. But when I rerun the following command to start a management cache server I get a error message.
    What is the conrect way ro repack the coherence.jar file?
    Can I unpack and edit the configuration files?
    F:\coherence\lib>java -Dcom.sun.management.jmxremote -Dtangosol.coherence.management=all -Dtangosol.
    coherence.management.remote=true -jar coherence.jar
    Failed to load Main-Class manifest attribute from
    coherence.jarBut I can start a start a non-management cache server or cache client using the new coherence.jar file.
    It is very strange. Can anyone explain it?
    Edited by: qkc on Dec 24, 2009 12:02 PM
    Edited by: qkc on Dec 24, 2009 1:13 PMDon't bother with modifying the jar file. It is not necessary at all.
    You can start a cache server with the following command on Windows (on Linux or UNIX systems use colon instead of semicolon and use forward slash instead of backslash in the command):
    java -cp resDir;pathToCoherenceJar\coherence.jar ... com.tangosol.net.DefaultCacheServer cacheConfigurationFileNamewhere resDir is the path to the directory containing the cache configuration file or any resources to be resolved from the classpath and pathToCoherenceJar is the path to the directory containing the coherence.jar file.
    The cacheConfigurationFileName can remain coherence-cache-config.xml or you can use a different filename, it does not matter, it will take precedence over whatever is in the coherence.jar file. Of course the file should exist.
    The ... in the above command line must be substituted with any Java properties you want specified (-Dwhatever).
    Best regards,
    Robert

  • Failed to load Main-Class manifest attribute from jar

    I get this error when i try start a executable jar file:
    Failed to load Main-Class manifest attribute from
    even though i have a
    Main-Class: a.b.c.MyClass
    entry in the meta-inf/manifest.mft
    I also have a (rather long) "Class-Path:" entry preceeding the "Main-Class:" entry in the manifest. What's wrong?

    ant has a major problem with very long "Class-Path" entries in a manifest file.
    The ant manual states, that jars wrap lines in manifest files longer than 72 characters. They say it's not their fault, and they can't do anything about it...
    I need to make an executable jar file with a classpath of approx. 200 characters.
    When i use Netbeans to jar the project, everythings fine.
    But using ant, the Class-Path seems to get messed up and none of the external classes are found, even though the manifest looks just like the one generated by Netbeans and the jar contents are the same.
    One way to workaround this problem is by using a manifest like this:
    Class-Path: some.jar foo.jar
      someother.jar
      guesswhat.jar
    Main-Class: what.everPlease take note of the leading spaces on the second and third Class-Path line.
    But i don't think, there's any way to make ant create a manifest like that using the ant <manifest> tag, because you can only specify a single "Class-Path" attribute, empty attributes are not allowed and if you use ${line.separator} to break lines, the line will still get a hard break after 72 characters. D'uh!
    Looks to me like a case of denial.
    On the other hand, there's another good idea to be found at jakarta:
    http://jakarta.apache.org/commons/sandbox/hivemind/jakarta-hivemind/ant/ManifestClassPath.html
    I'm going to check tomorrow if this might solve the problem.
    Or is there some other magical ingredient missing in the ant generated jar, that the NetBeans generated jar has??
    The most interesting part is, that i can't even make the ant jar run properly, if i call
    java -classpath ... -jar myAnt.jar

  • Jar doesn't populate Class-Path from manifest to target .jar

    I have a manifest file with the following content:
    Manifest-Version: 1.0
    Name: webserver.jar
    Main-Class: Acme.Serve.Serve
    Java-Bean: False
    Class-Path: webserver.jar servlet.jarHowever result META-INF/MANIFEST.MF populated by jar in webserver.jar doesn't have Class-Path entry. What's the trick without manual editing MANIFEST.MF in .jar?

    The following extension of the class Bar.java will at least get the information from the jar file.
    package bar;
    import foo.Foo;
    import java.io.File;
    import java.io.IOException;
    import java.util.Iterator;
    import java.util.Map;
    import java.util.Set;
    import java.util.jar.Attributes;
    import java.util.jar.JarFile;
    import java.util.jar.Manifest;
    public class Bar {
      public static void main(String[] argv) {
        try {
          String classpath = Foo.getPath();
          System.out.println("java.class.path=" + classpath);
          if (!new File(classpath).isDirectory()) {
         JarFile f = new JarFile(classpath);
         Manifest mf = f.getManifest();
         Attributes a = mf.getMainAttributes();
         Iterator keys = a.keySet().iterator();
         while (keys.hasNext()) {
           Attributes.Name key = (Attributes.Name)keys.next();
           String value = a.getValue(key);
           System.out.println(key + "=" + value);
        catch (IOException ioe) {
          System.err.println("Error: " + ioe.getMessage());
    }

  • Class-path attribute & exploded structure

    hi all,
    I've got an exploded app and I'm trying to deploy a session bean
    which has some dependencies on other helper classes.. I've wrote a manifest file
    and I've specified the class-path attribute, but I still get java.lang.NoClassDefFoundError..
    I wonder if manifest file is working for an exploded structure...
    did anybody tried that ?
    thanks for your time,
    cheers

    Manifest classpath (aka JAR dependencies) is a J2EE 1.3 concept. Expect to see it when iAS supports J2EE 1.3.

Maybe you are looking for

  • Creation of Project Profile & Network Profile

    Hi Experts, I am new to PS. We have a customer project which has two company codes. Company 1 has three plants and company 2 has one plant. Our client will use PS for new product development projects. That new product will be developed in a single pl

  • RDP to Windows 8 or 8.1 issues - admin or console connection not working

    Hi, I have a number of issues when connecting to my Win8 Pro (and now Win8.1 Pro) machine via RDP. First off, I know that most of the issues I am about to list below should technically be resolved if I connect to the console or admin session of my ma

  • Lose internet when plugging into switch

    I am perplexed why I can create a wireless network with my airport extreme and have great internet connectivity through my cable company, but when I plug the airport into a switch to distribute the internet through out my office the internet immediat

  • AddOnRegDataGen.exe in Batch File

    I'm trying to follow these instructions from Frank Moebius: please note that AddOnRegDatGen is batch capable!!! Here you go: Calling convention (cmdline parameters): AddOnRegDataGen.exe <raw xml> <InstallerVersion> <Installer> <Uninstaller> <Add-On-E

  • When reinstalling OS X with install disk, wireless mouse doesn't work

    I have an unusual problem: My iMAC G5 hard drive died and I installed a replacement disk. Now, I am trying to reinstall OS X 10.3 with the help of my original install CDs that came with the iMAC. Unfortunately, my wireless mighty mouse doesn't react