EAR + EJB + Spring Class-Path problem

Hi,
I'd been using JDeveloper for a few years, but this is the firstime I package an EJB application. I have two jars (the ejb.jar and api.jar) both are using the Spring 2.0 Library that JDeveloper provides.... but when I package the EJB as an EAR everything seems to be OK:
-ear
- META-INF
- application.xml
- ejb.ar
- api.jar
- spring.jar
But when I try to publish the EAR in the OC4J standalone management console, this error is thrown:
oracle.classloader.util.AnnotatedNoClassDefFoundError:      Class not found: org.springframework.ejb.support.AbstractStatelessSessionBean.     Dependent Class sv.com.sti.ebs.sgd.ejb.SgdTrxSessionBean
     Cargador: sgd-ear.root:0.0.1
(Failure analysis caught java.lang.NullPointerException)
So I Think the ejb is not using the spring libraries located in the EAR's root or maybe I have to add the classes to the ejb's manifest.....But JDeveloper ejb jar deployment doesn't add any entries in the Manifest Class-Path entry....
Please Help.

Hi
Try putting the utility classes in an EJB JAR file, then putting a Class-Path attribute in the MANIFEST.MF for that JAR far. That is
Class-Path: lib/myutils.jar
It doesn't matter where you put the utility JAR, so long as it's somewhere in the EJB JAR and you specify it in Class-Path. This should make the utility classes accessible to servlets as well. Note that classes defined in a WAR file's ./lib directory willl not be accessible to EJBs, as a matter of policy.
Best wishes
Kevin

Similar Messages

  • Class path problem in Sun Studio Creator

    dear,
    I have Sun Studio Creator 30 days Trail. i can't compile the EJB Classes. Is there any class path setting in the IDE?. Help me to solve the problem. the EJB class javax.ejb.* package is not found. I am using the deployment server (Sun Application Server 8.0 this could deployed the example files written for EJB. i don't guess what is the major problem.

    http://en.wikipedia.org/wiki/Classpath_(Java)#Setting_the_path_in_a_Manifest_file explains it well.

  • Applet with class path Problem

    Hi all,
    I am facing a strange problem: I wrote an applet and sign it tomake it able to access some client resources, my applet is intended to play audio mp3 files, so I need some libs like jmf.jar, if my libs do not exist I recieve them from my web app via URLConnection to servlet.
    after libs download completing, I can not instantiate any of libs class because my libs do not exist in the class-path.
    I need any suggestion. what can I do?
    1 - change the class path - during run time - to point to the current libs location.
    or
    2 - load the jar libs manually - during run time - and instantiate my classes.
    or what?
    please include examples.
    Thanks
    Ahmad Elsafty

    PATH and CLASSPATH are different. PATH is an environment variable used by windows to locate programs. CLASSPATH is an environment variable that java uses to find classes.
    You need to create a new environment variable. The easiest way to do it in win2k (and to keep it after you reboot) is to do this: right click on "My Computer" and click "Properties" (or go to "System" in the control panel). Click on the "Advanced" tab. Click the "Enviroment Variables..." button. In that window, add a system variable by clicking "New..." in the bottom half. Variable Name: "CLASSPATH" Variable Value: ".;J:\Skribe\Tools\mysql-connector-java-3.0.0-beta\mysql-connector-java-3.0.0-beta-bin.jar;J:\jakarta-log4j-1.2.6\dist\lib\log4j-1.2.6.jar"
    You have to make sure that ".;" is the first thing on the line. This tells java to look in the current active directory first for classes it doesn't recognize, then in locations you specify. By default, it just looks in the current directory.
    Hope this helps.

  • Class-Path problem in MANIFEST.MF file

    Hello,
    I have one jar file in which defined class-path like this:
    %programfiles(x86)%/%OPENOF~1.ORG%/Basis/program/classes/officebean.jar
    but with no luck , system says following:
    Class Path entry %programfiles(x86)%/%OPENOF~1.ORG%/Basis/program/classes/officebean.jar  does not point to a valid jar for a Class-Path referenceI even tried
    C:\Program Files (x86)\OpenOffice.org 3\program\classes\officebean.jarbut error is same, i can not understand what's wrong, i have windows 7 x64 with jdk 1.6.24 , also java home is set

    http://en.wikipedia.org/wiki/Classpath_(Java)#Setting_the_path_in_a_Manifest_file explains it well.

  • Class path problem

    Hi,
    i installed j2sdk1.4.0 in my PC.
    And i set path in environment variables
    JAVA_HOME
    the path of j2sdk and saved..
    now when i go to comman promt and say javac
    its not idetifying..
    then iam setting classpath and path at command prompt..
    then javac working.
    that means if set java home the class path it wont take automatically..
    we have to set again at our desired location.
    Regards,

    Adding JAVA_HOME variable to the system is not enough, you need to add the %JAVA_HOME%/bin to your system path
    Add following to your system's path variable
    %JAVA_HOME%/bin;
    (i assume you have windows OS)

  • Class path problem with POJO web service

    I created a simple web service manually:
    - created java class;
    - generated web-services.xml
    - coplied web-services.xml into my *.war file, WEB-INF directory.
    This works fine as long as the class that implements web service is in the war file in folder /WEB-INF/classes.
    I need the java class to be in one of the jar files in the folder /WEB-INF/lib. This does not work. I am getting class not found error.
    I tried to modify <java-class> element to specify the jar file (the same way as ejb-link element does):
    <java-class class-name="my.jar#my.Service" name="MyService">
    </java-class>
    This did not help either. How can I specify name of POJO class in the *.jar file?
    Thanks,
    Serguei

    PATH and CLASSPATH are different. PATH is an environment variable used by windows to locate programs. CLASSPATH is an environment variable that java uses to find classes.
    You need to create a new environment variable. The easiest way to do it in win2k (and to keep it after you reboot) is to do this: right click on "My Computer" and click "Properties" (or go to "System" in the control panel). Click on the "Advanced" tab. Click the "Enviroment Variables..." button. In that window, add a system variable by clicking "New..." in the bottom half. Variable Name: "CLASSPATH" Variable Value: ".;J:\Skribe\Tools\mysql-connector-java-3.0.0-beta\mysql-connector-java-3.0.0-beta-bin.jar;J:\jakarta-log4j-1.2.6\dist\lib\log4j-1.2.6.jar"
    You have to make sure that ".;" is the first thing on the line. This tells java to look in the current active directory first for classes it doesn't recognize, then in locations you specify. By default, it just looks in the current directory.
    Hope this helps.

  • Linux class path problem

    hello,
    I have the following directories in my /home/user/project directory
    /resources (contains .jar files)
    /builds/version01 (contains the .class files)
    Does anyone know how to run the .class files? I have tried various combinations in linux and I get errors either about the classpath. The thing is also that I want to load the .jar files from /resources at the same time
    Thanx ...
    Rigas

    hello,
    I have the following directories in my
    /home/user/project directory
    /resources (contains .jar files)
    /builds/version01 (contains the .class files)
    Does anyone know how to run the .class files? I have
    tried various combinations in linux and I get errors
    either about the classpath. The thing is also that I
    want to load the .jar files from /resources at the
    same time
    Thanx ...
    Rigasif you have root permissions edit the /etc/profiles file and add the classpath there. Make sure to point it to all of the jar files explicitly... i.e. /home/somefolder/somejar.jar
    if not there is a profile somwhere in you r home directory that you can edit

  • Path problem in windows os

    Dear friends,
    some time I meet a strange class path problem under windows enviroment. that is, the class path uses "/" to splite directory while not "\". so java will report error message like "NoClassFoundError: com/boland/...". I think there should be a way to adjust this environment problem. but I don't know how to set this. I will greatly appreciate if you happen to know this and let me know.
    Best wishes,
    Sam

    You reported an error in a package statement or reference. This is nothing to do with the OS folder structure per se, altho that is how it is implemented on a given platform like windows. Classpath statements are NOT platform independent, due to path separator issues. You should not use a system-wide classpath variable anyway, as this is really quite bad practice. Instead, create a run script for you program, and put the -cp switch in there. In any case, you should be referencing packages (separated by dots) in there anyway, not actual paths.

  • WebLogic 11g EAR EJB Classpath and class loaders

    All,
    I have been having issues migrating Spring based EJB applications from OC4J to WebLogic 11g (10.3.1). I have been in communication with Oracle who has suggested a work around however I am keen to see if anyone else can suggest a solution.
    The application is dependant on stateless session EJB beans that communicate with a Spring managed service tier to perform the business logic and database access. PitchFork is used to inject the Spring managers into the EJB’s using the spring-ejb-jar.xml configuration file. Note originally I was using the SpringBeanAutowiringInterceptor however I could not get this to work. See WebLogic 11g and Spring beens injected into EJB for details.
    When the application is deployed packaging all the dependant jars within the APP-INF\lib folder I get a verity of errors from the following InvalidClassException, NoSuchMethodError, AbstractMethodError and IllegalArgumentException. I am using Spring 2.5.3 to match the supported WebLogic version. Note within the EAR application.xml the library-directory is set to APP-INF/lib. The issue appears to be Spring, PitchFork, commons-logging and aspectj libraries are being loaded form WebLogic and do not have visibility on jars within the application or have been modified when bundled for WebLogic. An example of this is the PitchFork jar within WebLogic has been changed excluding the spi package resulting in java.lang.ClassNotFoundException: org.springframework.jee.spi.PitchforkUtilsImpl errors.
    Moving the jars to the domain library path does not resolve any of the issues. I have been unable to successfully deploy the application picking up the application jars using the prefer-application-packages configuration.
    Oracle has advised me to deploy the libraries into the WebLogic system classpath by modifying the startWebLogic command to load the libraries into the classpath. I am concerned that modifying the system classpath will result in an unstable WebLogic server as I will be replacing modified jar files packages with WebLogic (such as PitchFork). This will also limit the applications that can be deployed within the server as each application must use the same libraries and versions (as the application ibraries are leing ignored).
    Has anyone else hit this issue and corrected it? Can anyone think of an alternative solution?
    Regards
    Neil

    Hi,
    I am in the process of updating the tracking bug# 331569 with copies of the eclipse EAR/WAR projects and the EAR for these scenarios. Here are some details on how I got past the 2nd CCE on the org.eclipse.persistence.jpa.PersistenceProvider class (not the javax one)
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=331569
    Essentially an SE persistence unit running both JPA 2.0 api and the 2.0 XSD schema work fine. I will next retest the EE case with variations of the 3 types of injection on the SSB or Servlet.
    Update: There are 3 (possibly 4) issues here (all of these may become obsolete when the next WLS version ships)Initially I got the same 2.0 schema error and the ClassCastException on org.eclipse.persistence.jpa.PersistenceProvider
    It turns out that my import of the 2 eclipse projects from my bug # 296271 for WebLogic 10.3.2.0 lost their facets(specifically the dynamic web facet) because I associated them with a different WebLogic 10.3.3.0. - this caused the CCE I was experiencing like Sri.
    Anyways, after creating an EAR/Web project combination from scratch in eclipse associated with the 10.3.3.0 instance - I predeployed/deployed/ran fine - even with the 2.0 schema - in SE bootstrap mode (no EE yet).
    Reproduction Procedure:
    redoing project from scratch as I noticed that the war was not at the root of the ear - it was a jar in the app-inf/lib dir - my imported eclipse project was not referenced correctly as a web module facet- create empty EAR and WAR project with references
    - download and open my EAR and WAR project code from bug # 296271
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=296271
    - do essentially all the steps in the page below (I paraphrase for re-verification)
    http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#DI_1.1:_Alternative_3:_Application_Level_Shared_Library_-InUse
    - copy applicationService, entity and FrontController servlet code into new projects
    - create persistence.xml and MANIFEST.MF manifest in src\META-INF
    - update manifest
    Class-Path: APP-INF/lib/eclipselink.jar
    APP-INF/lib/javax.persistence_2.0.0.v200911041116.jar
    - copy both javax.persistence 2.0 and eclipselink 2.x jars to APP-INF/lib
    - change ordering of WebLogic library modules classpath reference (javax.persistence 1.0) to ear reference (2.0 version)
    - update web.xml with servlet tags
    - update weblogic.xml with new context root
    - make the persistence unit name the same in persistence.xml and ApplicationManagedService
    - update weblogic-application.xml with prefer-application-packages overrides
    <wls:prefer-application-packages>
    <wls:package-name>javax.persistence.*</wls:package-name>
    <wls:package-name>org.eclipse.persistence.*</wls:package-name>
    </wls:prefer-application-packages>
    - enable server redirect logging
    <!-- new for 10.3.3.0 http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging#Server_Logging -->
    <property name="eclipselink.logging.logger" value="DefaultLogger"/>
    - start WebLogic 10.3.3.0
    - deploy (run on) server from eclipse or export ear to auto deploy directory
    1) JPA 2.0 XSD usage on 10.3.3.0
    - I reproduced this issue with a bad EAR
    - was able to use the 2.0 schema within the WAR-only application managed EAR
    persistence.xml<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <!-- persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"-->
    <persistence-unit name="example2" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>localJTA</jta-data-source>
    <class>org.eclipse.persistence.example.business.Cell</class>
    <shared-cache-mode>NONE</shared-cache-mode>
    <properties>
    <property name="eclipselink.target-server" value="WebLogic_10"/>
    <property name="eclipselink.logging.level" value="FINEST"/>
    <property name="eclipselink.target-database" value="Derby"/>
    <!-- new for 10.3.3.0 http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging#Server_Logging -->
    <property name="eclipselink.logging.logger" value="DefaultLogger"/>
    <!-- property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
    <property name="javax.persistence.jdbc.url" value="jdbc:derby://127.0.0.1:1527/dataparallel;create=true"/>
    <property name="javax.persistence.jdbc.user" value="APP"/>
    <property name="javax.persistence.jdbc.password" value="APP"/-->
    <!-- turn off DDL generation after the model is stable -->
    <!-- property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
    <property name="eclipselink.ddl-generation.output-mode" value="both"/-->
    </properties>
    </persistence-unit>
    </persistence>
    2) CCE on JPA provider implementation class
    Error instantiating the Persistence Provider class org.eclipse.persistence.jpa.PersistenceProvider of the PersistenceUnit example2: java.lang.ClassCastException: org.eclipse.persistence.jpa.PersistenceProvider
    - I reproduced and fixed this one (was Eclipse project facet issue) - EAR was wrong
    - was able to run JPA 2.0 code fine on an SE PU (predeploy/deploy together)
    - EE injection should not work but I will post an example EAR anyway
    log[EL Example]: enterprise: JPA 2.0 Metamodel: MetamodelImpl@56287508 [ 3 Types: , 1 ManagedTypes: , 1 EntityTypes: , 0 MappedSuperclassTypes: , 0 EmbeddableTypes: ]
    3) CCE on JPA spec interface class
    - I could not reproduce this one
    Re: WebLogic 11g EAR EJB Classpath and class loaders
    Error processing persistence unit PT of module pt: Error instantiating the Persistence Provider class org.eclipse.persistence.jpa.PersistenceProvider of the PersistenceUnit PT: java.lang.ClassCastException: org.eclipse.persistence.jpa.PersistenceProvider cannot be cast to javax.persistence.spi.PersistenceProvider
    4) CCE on fallback Kodo JPA provider (if an invalid say 2.1 JPA XSD schema is referenced)
    java.lang.ClassCastException: kodo.persistence.PersistenceProviderImpl
    at javax.persistence.Persistence.findAllProviders(Persistence.java:186)
    java.lang.NoSuchMethodError: javax/persistence/EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel;
    - reproduced by using the 1.0 javax.persistence jar (but named as the 2.0 one in APP-INF/lib)
    - fixed by using either the 1.0 or 2.0 JPA XSD schema and using the correct 2.0 spec jar
    thank you
    /michael

  • Class path issue with spring when deploy in oracle app server

    Hi there,
    i am using spring in an web application using jdeveloper. it is working perfectly for me in jdeveloper. when i trying to deploy it in appserver ( oracle enterprise manager 10g) i am getting following error,
    Failed to deploy web application "china". Failed to deploy web application "china". . Nested exception
    Resolution:
    Base Exception:
    com.evermind.server.rmi.OrionRemoteException
    Class not found: org.springframework.beans.factory.access.BootstrapException; nested exception is:
    java.lang.ClassNotFoundException: org.springframework.beans.factory.access.BootstrapException. Class not found: org.springframework.beans.factory.access.BootstrapException; nested exception is:
    java.lang.ClassNotFoundException: org.springframework.beans.factory.access.BootstrapException
    i guess the problem is with classpath of these xml,
    <!-- j2ee parent config file-->
    <context-param>
    <param-name>locatorFactorySelector</param-name>
    <param-value>/resources/beanRefContext.xml</param-value>
    </context-param>
    <!-- parent context key defined in the config file -->
    <context-param>
    <param-name>parentContextKey</param-name>
    <param-value>servicelayer-context</param-value>     
    </context-param>
    i don know how to fix this issue. it is working fine in local jdeveloper. does any one have some idea please help me out..
    Regards,
    A.

    Hi,
    do you deploy the Spring classes with the application ? I suggest to try the OracleAs forum as well to ensure this has to be in a specific path to be loaded. A list of forums is available from here
    http://forums.oracle.com/forums/index.jspa?categoryID=84
    Frank

  • Problem: Multiple jar files in Class-Path [ IOException: line too long]

    Hello Folks,
    I am trying to create a jar file using the following command:
    jar -cvfm mygrid.jar MANIFEST.MF -C grid-jar/ .
    My MANIFEST.MF file is as following:
    Manifest-Version: 1.0
    Main-Class: com.gridftp.INSPgridFTP
    Class-Path: lib/activation.jar lib/ant.jar lib/antlr.jar lib/axis.jar lib/castor-0.9.3.jar lib/cog-abstraction-common-2.0.jar lib/cog-abstraction-examples-2.1.jar lib/cog-certmanagement-1.0.jar lib/cog-certrequest-1.0.jar lib/cog-grapheditor-0.46.jar lib/cog-gridfaces-1.0.jar lib/cog-gridshell-1.0.jar lib/cog-jglobus-1.2-050621.jar lib/cog-karajan-0.31.jar lib/cog-provider-clref-gt3_0_2.jar lib/cog-provider-clref-gt3_2_0.jar lib/cog-provider-clref-gt3_2_1.jar lib/cog-provider-clref-gt4_0_0.jar lib/cog-provider-condor-2.0.jar lib/cog-provider-gt2-2.0.jar lib/cog-provider-gt2ft-1.0.jar lib/cog-provider-gt3_0_2-2.0.jar lib/cog-provider-gt3_2_0-2.0.jar lib/cog-provider-gt3_2_1-2.0.jar lib/cog-provider-gt4_0_0-2.2.jar lib/cog-provider-local-2.0.jar lib/cog-provider-ssh-2.0.jar lib/cog-provider-webdav-1.0.jar lib/cog-resources-1.0.jar lib/cog-setup-0.91.jar lib/cog-util-0.91.jar lib/commons-discovery.jar lib/commons-httpclient.jar lib/commons-logging.jar lib/concurrent.jar lib/cryptix32.jar lib/cryptix-asn1.jar lib/cryptix.jar lib/j2ssh-common-0.2.2.jar lib/j2ssh-core-0.2.2.jar lib/jaas.jar lib/jakarta-regexp-1.2.jar lib/jakarta-slide-webdavlib-2.0.jar lib/jaxrpc.jar lib/jce-jdk13-125.jar lib/jgss.jar lib/jug-1.0.1.jar lib/junit.jar lib/log4j-1.2.8.jar lib/mail.jar lib/puretls.jar lib/saaj.jar lib/wsdl4j.jar lib/xercesImpl.jar lib/xml4j.jar lib/xml-apis-1.1.jar lib/xmlsec.jar lib/xpp3-1.1.3.4d_b4_min.jar lib/xstream-1.1.1-patched.jar .
    The grid-jar directory structure is:
    | - com -- all classes are under this dir.
    | - lib -- all the required jar files are in this dir.
    There are 59 jar files in the lib directory. When I try to create the jar file, I get the following exception:
    jar -cvfm mygrid.jar MANIFEST.MF -C grid-jar/ .
    java.io.IOException: line too long
    at java.util.jar.Attributes.read(Attributes.java:356)
    at java.util.jar.Manifest.read(Manifest.java:167)
    at java.util.jar.Manifest.<init>(Manifest.java:52)
    at sun.tools.jar.Main.run(Main.java:124)
    at sun.tools.jar.Main.main(Main.java:904)
    Any idea, why do I get this exception? Is there any restriction as to how many jar files (or characters) can be there in the Class-Path value in the MANIFEST.MF file?
    Please help.
    Thanks,
    Ana

    use as the following way to resolve the problem:
    (1) use separate lines, to avoid too long a line for java package name lists
    (2) type a preceding space before each folloing lines, for example:
    Class-Path: ...jar ...jar ...jar
    ...jar ..jar
    ...jar ...jar
    ...jar ...jar
    Hello Folks,
    I am trying to create a jar file using the following
    command:
    jar -cvfm mygrid.jar MANIFEST.MF -C grid-jar/ .
    My MANIFEST.MF file is as following:
    Manifest-Version: 1.0
    Main-Class: com.gridftp.INSPgridFTP
    Class-Path: lib/activation.jar lib/ant.jar
    lib/antlr.jar lib/axis.jar lib/castor-0.9.3.jar
    lib/cog-abstraction-common-2.0.jar
    lib/cog-abstraction-examples-2.1.jar
    lib/cog-certmanagement-1.0.jar
    lib/cog-certrequest-1.0.jar
    lib/cog-grapheditor-0.46.jar
    lib/cog-gridfaces-1.0.jar lib/cog-gridshell-1.0.jar
    lib/cog-jglobus-1.2-050621.jar
    lib/cog-karajan-0.31.jar
    lib/cog-provider-clref-gt3_0_2.jar
    lib/cog-provider-clref-gt3_2_0.jar
    lib/cog-provider-clref-gt3_2_1.jar
    lib/cog-provider-clref-gt4_0_0.jar
    lib/cog-provider-condor-2.0.jar
    lib/cog-provider-gt2-2.0.jar
    lib/cog-provider-gt2ft-1.0.jar
    lib/cog-provider-gt3_0_2-2.0.jar
    lib/cog-provider-gt3_2_0-2.0.jar
    lib/cog-provider-gt3_2_1-2.0.jar
    lib/cog-provider-gt4_0_0-2.2.jar
    lib/cog-provider-local-2.0.jar
    lib/cog-provider-ssh-2.0.jar
    lib/cog-provider-webdav-1.0.jar
    lib/cog-resources-1.0.jar lib/cog-setup-0.91.jar
    lib/cog-util-0.91.jar lib/commons-discovery.jar
    lib/commons-httpclient.jar lib/commons-logging.jar
    lib/concurrent.jar lib/cryptix32.jar
    lib/cryptix-asn1.jar lib/cryptix.jar
    lib/j2ssh-common-0.2.2.jar lib/j2ssh-core-0.2.2.jar
    lib/jaas.jar lib/jakarta-regexp-1.2.jar
    lib/jakarta-slide-webdavlib-2.0.jar lib/jaxrpc.jar
    lib/jce-jdk13-125.jar lib/jgss.jar lib/jug-1.0.1.jar
    lib/junit.jar lib/log4j-1.2.8.jar lib/mail.jar
    lib/puretls.jar lib/saaj.jar lib/wsdl4j.jar
    lib/xercesImpl.jar lib/xml4j.jar lib/xml-apis-1.1.jar
    lib/xmlsec.jar lib/xpp3-1.1.3.4d_b4_min.jar
    lib/xstream-1.1.1-patched.jar .
    The grid-jar directory structure is:
    | - com -- all classes are under this dir.
    | - lib -- all the required jar files are in
    e in this dir.
    There are 59 jar files in the lib directory. When I
    try to create the jar file, I get the following
    exception:
    jar -cvfm mygrid.jar MANIFEST.MF -C grid-jar/ .
    java.io.IOException: line too long
    at
    at
    at
    at
    java.util.jar.Attributes.read(Attributes.java:356)
    at
    at
    at java.util.jar.Manifest.read(Manifest.java:167)
    at
    at
    at java.util.jar.Manifest.<init>(Manifest.java:52)
    at sun.tools.jar.Main.run(Main.java:124)
    at sun.tools.jar.Main.main(Main.java:904)
    Any idea, why do I get this exception? Is there any
    restriction as to how many jar files (or characters)
    can be there in the Class-Path value in the
    MANIFEST.MF file?
    Please help.
    Thanks,
    Anajust

  • 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.

  • Domain/lib class path issues

    Hello,
    We are migrating one of our applications from Web Logic 8.1 to 10. The new instance is going to have 2 managed servers, under the web logic domain, hosting the server EAR as well as web WAR respectively. Now the application has certain jars that need to be available for the startup classes in both these modules. As Web Logic provides a feature to place the jars in the domain/lib so they are visible to both the applications, we have included the jars in the domain/lib directory. However, when the startup class loads, it is not able to access any of the classes that are part of the jars in the domain/lib folder! Instead, we are presented with a NoClassDefinitionFound error!!
    I am writing to see if any one has any insight on what could be causing this and if this is doable in the first place!
    Thanks,
    SG

    You are facing the problem of classloaders.
    What is inside the ejb classloader, cannot be accessed by a sibling classloader or a parent classloader.
    Thus, u need to package the home and remote interfaces inside the WAR.
    As regards the utilities used by ejb and servlets, place them at a common location: the servers classpath. Again, exercise some caution. If u place the utility classes in server's class path, then the ejb and servlets can access theese utility classes, but the utility classes cannot access the servlets/ejb classes (ie, utility will be in parent class loader and it cannot access the classes in its child classloaders)

  • JasperReports not working in EAR/EJB/JSF application

    Hi,
    When trying to compile a report using JasperReports, I get this exception. I have an EAR application, pdf generation happens in an EJB module, called by a WAR (Glassfish 3, JSF 2).
    Any clue?
    org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'jar:file:/C:/Users/Yannick%2520Majoros/dev/GestempsEE/dist/gfdeploy/GestempsEE/lib/jasperreports-3.7.0.jar!/net/sf/jasperreports/engine/dtds/jasperreport.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:2541)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2528)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:1825)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:531)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:766)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:550)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2408)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1753)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:767)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.apache.commons.digester.Digester.parse(Digester.java:1647)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:235)
    ... 73 more

    I did as you said:
    Sanity Test:-
    java -classpath .;MyEJB.jar LoadTest
    java.lang.ClassNotFoundException: com.myexample.IXMLSerializer
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at LoadTest.main(LoadTest.java:5)
    Now if I run the same command as follows
    java -classpath MyEJB.jar;.;dep1.jar LoadTest
    it works (including the dep1.jar in classpath)
    com.myexample.IXMLSerializer
    MyEJB.jar has the following structure:
    |
    &#9492;&#9472;&#9472;&#9472;META-INF\Manifest.mf
    Manifest-Version: 1.0
    Class-Path: dep1.jar
    dep1.jar is found in the same directory where I executed the sanity test command (since I unpacked the ear file)

  • 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

Maybe you are looking for