Ejb jar - packaging utility jars or classes?

Currently I have an ejb jar that contains 1 bean (say ejb1.jar). This bean uses some utility classes (say util.jar). If I add the actuall .class files from util.jar to ejb1.jar everything works great. If I add util.jar to ejb1.jar I get errors like:
Unable to deploy EJB: SomeBean from ejb1.jar.jar:
java.lang.NoClassDefFoundError: com/xxxx/xxxx/SomeClass
Shouldn't adding the util.jar file directly to the ejb1.jar file work? Do I have to do anything extra to get it to work?
thanks,
ryan

http://edocs.bea.com/wls/docs70/programming/classloading.html#1069420
"Ryan Van Luttikhuisen" <[email protected]> wrote in message
news:[email protected]..
Currently I have an ejb jar that contains 1 bean (say ejb1.jar). Thisbean uses some utility classes (say util.jar). If I add the actuall .class
files from util.jar to ejb1.jar everything works great. If I add util.jar
to ejb1.jar I get errors like:
>
Unable to deploy EJB: SomeBean from ejb1.jar.jar:
java.lang.NoClassDefFoundError: com/xxxx/xxxx/SomeClass
Shouldn't adding the util.jar file directly to the ejb1.jar file work? DoI have to do anything extra to get it to work?
>
thanks,
ryan--
Dimitri

Similar Messages

  • JAR Compressor Utility (jar.exe) Location

    I am trying to jar some documentation and I cant find the path for the JAR Compressor Utility (jar.exe). I have downloaded JaveHelp and its not located there. Its also reffered to as JAR Archiver (jar.exe).

    If you have only the Java Runtime (look for "JRE") you will not have jar.exe. That is part of the JDK download package, available here:
    http://java.sun.com/javase/downloads/
    The documentation package has usage information.

  • Packaging Utility JARs in EAR

    Hi,
    At present, we create a single enterprise archive (.ear) containing all utility packages (3rd party, framework) (jars) and EJB deployments. Our current .ear file is approximately 14MB.
    During a recent investigation to resolve a JNI DLL reloading issue, we discovered that when loading new classes for an application, the runtime environment looks for classes in the following locations (in the following order): the bootstrap classpath, installed extensions (lib/ext directory of the JRE) and the classpath.
    It has been suggested that the utility and 3rd party jars are not packaged within the EAR, but are copied to the lib/ext directory of the JRE.
    The new .ear file is approximately 2MB. The advantages of this approach is that the EAR deployment is more lightweight and is thus more manageable by the application server.
    A further advantage is that the jars are in a single location. That is, if a jar is required by more than more EAR, it resides in a single location.
    Are there any negatives or performance impacts of this approach?
    Any information or suggestions would be highly appreciated.
    Regards,
    Rennay Dorasamy

    The only real negatives are:
    1) You can't change the libraries without restarting the java process (WLS in this case)
    2) Your extensions must be isolated and not refer to any classes in the classpath or application.
    FWIW, WLS 9 includes a new feature application libraries:
    http://e-docs.bea.com/wls/docs90/programming/libraries.html
    -- Rob

  • J2EE / JMS Controlling transaction in util.jar

    Hi all experts!
    I've a delicate problem where I want to handle transactions transparently for EJBs in my util jar. I�m familiar with the other alternatives (MDBs etc) and using them in other parts of the solution but they can�t be used here (need a synchronous request-reply).
    The description is a bit long but please bare with me, hopefully it is clear and understandable.
    Summary:
    Why can't I use a UserTransaction in a utility.jar when called from a EJB using container managed transaction.
    Senario:
    transport_util.jar:
    Transport utility package contains no EJBs, just simple java classes (to make usage / deployment more simple for the users of the util.jar).
    The EJBs use an ApplicationFacade in the transport_util.jar (not a EJB just a java class) providing a high level communication API for JMS transport, encapsuling JMS specific code, and providing the simple transport primitives:
    - void send(Object data) : writing fire and forget messages to JMS Queue
    - Object requestReply(Object data) : sending a request message and waiting
    synchronously for a reply message. Not pretty when using messaging but
    necessary in this solution.
    AnyEJB.jar:
    The �client� using the transport primitives in transport_util.jar. The transport_util.jar is included in the EAR application as a utility.jar. The EJBs can use either Container (CMT) or Bean Managed Transactions (BMT). The transport_util.jar shouldn�t set any limitations.
    Problem:
    The problem arise when a �client� EJB under CMT calls the requestReply function in the API. The message is written to the JMS Queue by the transport_util before it starts to listen for a reply, on a in Queue, which will be returned to the caller. The request message is nerver delivered to the recipient who there for won�t produce a reply.
    Why? Because it is written to the JMS Queue inside a transaction (implicit from the calling EJB) which has not been committed (and shouldn�t from the clients perspective) before the API starts to listen for the reply. No delivery until commit! The transactional parameter isn�t valid when inside a application server
    My idea of a solution:
    Start a new UserTransaction, putTx, inside the requestReply function to halt the callers transaction (J2EE doesn�t support nested trans) and use it around the put operation. After a successful put the putTx could be committed, without affecting the callers transaction, which would lead to the message being sent to the recipient and finally a reply could arrive. Only one big problem.:
    I get a naming exception when trying to lookup the UserTransaction through JNDI if the calling EJB use CMT but not if it uses BMT. Why? Is there a workaround?
    InitialContext ctxt = new InitialContext();
    UserTransaction putTx = ctxt.lookup(�java:comp/UserTransaction�)
    putTx.begin();
    // Put message on queue
    putTx.commit();
    // Try read reply from queue
    Infrastructure:
    - IBM WebSpehere Application Server 5
    - IBM WebSpehere MQ 5.3
    - Java 1.3
    Exception excerpt:
    Error occurred while handling transaction
    [2003-09-04 17:06:47:479 CEST] 7f8389dc SystemOut O javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".
    [2003-09-04 17:06:47:479 CEST] 7f8389dc SystemOut O      at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1003)
    [2003-09-04 17:06:47:479 CEST] 7f8389dc SystemOut O      at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1211)
    [2003-09-04 17:06:47:479 CEST] 7f8389dc SystemOut O      at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1203)
    [2003-09-04 17:06:47:479 CEST] 7f8389dc SystemOut O      at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1257)
    [2003-09-04 17:06:47:479 CEST] 7f8389dc SystemOut O      at javax.naming.InitialContext.lookup(InitialContext.java:359)
    /Best regards
    Jesper

    If anyone else have the same problem....
    After a great tip from a colleague a good solution if found!
    By getting hold of the TransactionManger from the ApplicationServer it is possible to suspend an ongoing transaction, start a new one and commit it and restart the suspended transaction again.
    Looking up the TransactionManger differs a lot from AppServer to AppServer. To find out how it is done on yours take a peak in the code of any of bigger persistence frameworks (I looked at Hibernate).
    So in pseudo code:
    // Error checks not in code to keep it short
    // Look up the TransactionManager
    TransactionManager mgrTx = //
    // Suspend callers Tx
    Transaction callerTx = mgrTx.suspend();
    // Start new transaction for the work to be performed
    // outside the callers transaction
    mgrTx.begin();
    // Perform transacted work .....
    // Commit
    mgrTx.commit();
    // Reassign the callers transaction to the thread and activate if
    mgrTx.resume(callerTx);/J

  • Where can i download the util.jar and base.jar File?

    Hi all,
    in some SAP-Notes are describe where i can download these Files.
    For Example:
    http://service.sap.com/netweaver
    SAP NetWeaver
    -> SAP Netweaver in Detail
        -> Application Platform
           -> DB and OS abstraction
              -> Platforms
                 -> Platform specific information
                    -> Microsoft      
    x SQL Server
    ZIP-File: "JDBC Driver for MS SQL Server"
    But there are no ZIP-File !!!
    Can anyone tell me where i can find the base.jar and util.jar File?

    Hi Christian,
    when using a vendor's JDBC drivers, you must go to the vendor to get them. For Microsoft here is a good place to start: http://www.microsoft.com/sql/downloads/
    These JDBC files should also be included with you SQL Server CDs...
    Hope this helps!
    Cheers,
    Jeff

  • How to update/replace Jars within sbconfig.jar during import

    Hi,
    I want to replace a jar file, used by java callout actions, during import. I am using WLST script to import configuration jar but cannot figure out how to replace jar file.
    That jar file contains environment specific properties which i intend to change as part of import, once config jar is uploaded and impoted within the same session.
    I have looked to Ref, ArchiveType, Refs, and ALSBConfigurationMBean, but cant figure out to replace specific jar file within imported config jar.
    Many thanks in advance!
    many thanks
    sal
    Edited by: sallo on 16-Feb-2010 07:40

    Hi vivik,
    I am already using custimization files to already to customize environment values etc. But what i need cannot be handled by the customization file.
    I want to replace a jar file (utility jar), already in the sbconfig jar, being referenced by Java Call out actions during import process. I am begining to convince myself that it is not possible to perform such action during import process. I have checked the MBeans API but not very helpful.
    I hope i have able to explain the problem here!
    many thanks
    sal

  • Where to put utility jar (used by EJB's and war)

    Hello all,
    In many cases when you create a web application including EJB's and a WAR file packaged together in an EAR file, you need some utility classes that are used in the EJB's as wel as in the servlets in the WAR. The utility classes might for example be value object classes that servlets use to exchange data with te EJB's.
    My question is: What is the best place to put the utility class files?
    There is a new article on JDC: http://developer.java.sun.com/developer/technicalArticles/J2EE/build/ that gives some tips. For example, it proposes to put the utility JAR in the EAR file and then add a "Class-Path:" entry to the MANIFEST.MF of the EJB's that use the utility classes.
    However, this approach does not work on BEA Weblogic 6.0. Weblogic's classloader just seems to ignore the "Class-Path:" in the EJB JAR's manifest.
    Any thoughts?
    regards
    Jesper

    The "CLASS-PATH" mechanism in that article is a new
    requirement in J2EE 1.3 (final draft 4). Therefore
    right now Weblogic does not support it yet. Now you
    need to put those utility classes in both the WAR (in
    WEB-INF/lib) and EJB JAR files. If you really want
    only 1 copy of the jar file deployed, you can manually
    add that jar file to weblogic server classpath in the
    start script under config/yourdomain.HI all,
    I have some Utility jar file for EJB and Web Application,
    In the second solution about one copy in weblogic,
    I tried it in the WLS60 it's ok
    But it didn't work in WLS61
    Anyone could give me any good suggestion?
    Moen

  • Using external util JAR from Session EJB

    I have a Stateless Session EJB that uses some classes packaged in a utility jar. How do I package the EJB jar with this util jar, and get the app server to recognize this utility jar? including a /lib dir with the utils jar in it, like you would with a WAR, doesn't work.
    I've temporarily got this to work by modifying the startup scripts for my app server to ensure my jar is included in the -classpath arg, but this cannot be the intended way. (cannot find details on this in the tutorial).
    Thanks in advance!

    Well, the answer depends a lot on which appserver you're using, because it obviously depends on how the vendor implemented the containers' ClassLoaders. What usually works is dependent upon a portion of the JVM spec regarding the MANIFEST.MF file. If you package your ejb.jar and library.jar in an .ear file, you can put the following in the ejb.jar MANIFEST.MF:
    ClassPath: library.jarNote that there must be at least one blank line at the end of the MANIFEST.MF file.
    This works on WebLogic, but, as an example, JBoss uses a single ClassLoader, so I'm not entirely sure how you'd go about the same thing there.
    And you're quite right - putting it in the JVM ClassPath is not a good idea...

  • Including utility jar when packing ejb in weblogic

    Hi,
    I am new to j2ee programming. I have an ejb which uses some utility jars. I followed the bea documents to structure the directory. The directory structure is, like,
    EjbProject
    - classes
    --com
    ---mine
    ----projectTracking --> has the class files of the ejb and supporting java files
    - src
    --com
    ---mine
    ----projectTracking --> contains the source files of the ejb and the supporting java files
    META-INF > contains ejb-jar.xml and weblogic-ejb-jar.xml
    The source java files are dependent on an utility jar file.
    so when I try the java weblogic.appc src, it throws me exception saying the utility file is missing. My question , is where should I put this utility jar file. Please send me your thoughts.
    Thanks in advance

    Hi,
    you can put your utility jar in the ear file along with the EJBs and make a classpath entry to these files in the EJB jar's META-INF\Manifest.mf file. As you said if you are working with weblogic you can put these files any where in the directory structure and place the entry in the startWeblogic.cmd file. But i recomend first option.
    Ashok.

  • EAR Packaging with utility jars

    In my application , the EJB's as well as servlets user log4j.jar ( logging
    utility). I have included the log4j.jar in
    WEB-INF/classes folder of the war file. Do I have to include the log4j.jar
    in the ejb-jar file also ? Do I have
    to explode the log4j.jar in the ejb-jar file or simply including the
    log4j.jar in the ejb-jar will suffice.
    BTW , I am using Weblogic 6.0 SP2 .

    Support for bundled extensions is mandated by the J2EE spec (since 1.2 I think) :
    "The J2EE platform supports the use of bundled extensions as specified in
    Support for Extensions and Applications in Version 1.2 of the Java Platform
    (available at http://java.sun.com/products/jdk/1.2/docs/guide/
    extensions/spec.html)."
    Ramu <[email protected]> wrote:
    hi Dimitri,
    Could you please throw more light on Class-Path of the ejb jar manifest? OR
    just point me to the related documentation.
    thanks,
    -ramu
    "Dimitri Rakitine" <[email protected]> wrote in message
    news:[email protected]..
    Since EJB classloader is a parent of WAR classloader, you can include the
    log4j.jar in the Class-Path: of the ejb jar manifest.
    See
    http://www.onjava.com/pub/a/onjava/2001/06/26/ejb.html and
    http://www.onjava.com/pub/a/onjava/2001/07/25/ejb.html
    Manish Parikh <[email protected]> wrote:
    In my application , the EJB's as well as servlets user log4j.jar
    logging
    utility). I have included the log4j.jar in
    WEB-INF/classes folder of the war file. Do I have to include thelog4j.jar
    in the ejb-jar file also ? Do I have
    to explode the log4j.jar in the ejb-jar file or simply including the
    log4j.jar in the ejb-jar will suffice.
    BTW , I am using Weblogic 6.0 SP2 .--
    Dimitri
    Dimitri

  • Coder needed to wrap my .jar using the JavaFX Packager Utility

    Hello-I am not a coder. I am looking for a programmer who is able to wrap my .jar using the JavaFX Packager Utility. I would like to upload my app to the Mac App Store also and need assistance doing that.
    Please contact me for more details if you are able to do one or both of the above.
    Thank you,
    Jeff
    Edited by: 929408 on Sep 9, 2012 9:16 PM

    Ok. Please let me know when you are able to upload the .jar I have (packaged) to the Macintosh App Store if you would. Do you need a way to contact me? I don't know if I am able to place my email or main website here, and I don't check here often. We can work out a payment arrangement. Thank you.

  • Modifying JAR file using java.util.jar package  over the network

    Hello,
    I am modifying a JAR file programmatically using java.util.jar package. The time taken to save the contents to a local disk is very less (around 1 sec) . When I tried modifying the JAR from a remote machine over the network (from mapped drive or shared folder of WIN NT), the time taken to save is 15-20 times more.
    I am recreating the whole JAR while modifying. Is there any way to improve the performance. Or is it possible to write only the changed files?
    Thanks,
    Prasad Y S.

    When you "update" a jar file, you must always recreate it from scratch.

  • WL tries to deploy utility jar file in .ear as an EJB

    I have an ear containing two ejb jars, one webapp war and a utility jar
    (common.jar). Deploying to
    WebLogic 6.1 sp2 results in deployment errors because WebLogic thinks
    the common.jar in a
    lib directory in the ear is an ejb jar:
    ==================================================================
    ><Apr 22, 2002 4:42:36 PM MDT> <Error> <J2EE> <Error deploying
    >application lib/common:
    >
    >Unable to deploy EJB: lib/common.jar from lib/common.jar:
    >
    >An error occurred while reading the deployment descriptor. The error was:
    > java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar file
    > at weblogic.ejb20.dd.xml.DDUtils.getEntry(DDUtils.java:332)
    > at weblogic.ejb20.dd.xml.DDUtils.getEjbJarXml(DDUtils.java:236)
    >.........
    >===================================================================
    Why does it think common.jar contains an EJB? My application.xml is:
    >
    ><application>
    > <display-name>TestUnit</display-name>
    > <module>
    > <ejb>TestUnit1.jar</ejb>
    > </module>
    > <module>
    > <ejb>TestUnit2.jar</ejb>
    > </module>
    > <module>
    > <web>
    > <web-uri>WebApp1.war</web-uri>
    > <context-root>WebApp1</context-root>
    > </web>
    > </module>
    ></application>

    Hi.
    Please open a case with support.
    Regards,
    Michael
    Rick Holland wrote:
    I have an ear containing two ejb jars, one webapp war and a utility jar
    (common.jar). Deploying to
    WebLogic 6.1 sp2 results in deployment errors because WebLogic thinks
    the common.jar in a
    lib directory in the ear is an ejb jar:
    ==================================================================
    <Apr 22, 2002 4:42:36 PM MDT> <Error> <J2EE> <Error deploying
    application lib/common:
    Unable to deploy EJB: lib/common.jar from lib/common.jar:
    An error occurred while reading the deployment descriptor. The error was:
    java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar file
    at weblogic.ejb20.dd.xml.DDUtils.getEntry(DDUtils.java:332)
    at weblogic.ejb20.dd.xml.DDUtils.getEjbJarXml(DDUtils.java:236)
    ===================================================================Why does it think common.jar contains an EJB? My application.xml is:
    <application>
    <display-name>TestUnit</display-name>
    <module>
    <ejb>TestUnit1.jar</ejb>
    </module>
    <module>
    <ejb>TestUnit2.jar</ejb>
    </module>
    <module>
    <web>
    <web-uri>WebApp1.war</web-uri>
    <context-root>WebApp1</context-root>
    </web>
    </module>
    </application>
    Michael Young
    Developer Relations Engineer
    BEA Support

  • [Newbie] Bundling App classes+ util jars with jni libraries

    Hi,
    first off, im a noob if it gets to creating archives... I can make a simple archive if I dont have special depedancies but beyond that... :)
    I have my app's classes and two utility jar files which also need respective jni libraries.
    Can I pack all of it in an archive for zero deploy or do the jni libraries need to be installed?
    Thanks,
    Dominik

    Since the jni-Libraries (or .so/.dll if you're doing a multi-platform deploy) contain native code, they have to be loaded and memory-mapped by the OS, so I'd guess that they have to be deployed seperately from your .jar file.
    They don't however need to be installed into the system and can reside in a seperate directory in the applications directory structure. Then you will only have to tell the JRE about this directory (let's call it "./lib"):
    java -Djava.library.path=./lib -jar myapp.jar
    HTH :)
    Marcus

  • Problem in Creating a jar file using java.util.jar and deploying in jboss 4

    Dear Techies,
    I am facing this peculiar problem. I am creating a jar file programmatically using java.util.jar api. The jar file is created but Jboss AS is unable to deploy this jar file. I have also tested that my created jar file contains the same files. When I create a jar file from the command using jar -cvf command, Jboss is able to deploy. I am sending the code , please review it and let me know the problem. I badly require your help. I am unable to proceeed in this regard. Please help me.
    package com.rrs.corona.solutionsacceleratorstudio.solutionadapter;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.util.jar.JarEntry;
    import java.util.jar.JarOutputStream;
    import java.util.jar.Manifest;
    import com.rrs.corona.solutionsacceleratorstudio.SASConstants;
    * @author Piku Mishra
    public class JarCreation
         * File object
         File file;
         * JarOutputStream object to create a jar file
         JarOutputStream jarOutput ;
         * File of the generated jar file
         String jarFileName = "rrs.jar";
         *To create a Manifest.mf file
         Manifest manifest = null;
         //Attributes atr = null;
         * Default Constructor to specify the path and
         * name of the jar file
         * @param destnPath of type String denoting the path of the generated jar file
         public JarCreation(String destnPath)
         {//This constructor initializes the destination path and file name of the jar file
              try
                   manifest = new Manifest();
                   jarOutput = new JarOutputStream(new FileOutputStream(destnPath+"/"+jarFileName),manifest);
              catch(Exception e)
                   e.printStackTrace();
         public JarCreation()
         * This method is used to obtain the list of files present in a
         * directory
         * @param path of type String specifying the path of directory containing the files
         * @return the list of files from a particular directory
         public File[] getFiles(String path)
         {//This method is used to obtain the list of files in a directory
              try
                   file = new File(path);
              catch(Exception e)
                   e.printStackTrace();
              return file.listFiles();
         * This method is used to create a jar file from a directory
         * @param path of type String specifying the directory to make jar
         public void createJar(String path)
         {//This method is used to create a jar file from
              // a directory. If the directory contains several nested directory
              //it will work.
              try
                   byte[] buff = new byte[2048];
                   File[] fileList = getFiles(path);
                   for(int i=0;i<fileList.length;i++)
                        if(fileList.isDirectory())
                             createJar(fileList[i].getAbsolutePath());//Recusive method to get the files
                        else
                             FileInputStream fin = new FileInputStream(fileList[i]);
                             String temp = fileList[i].getAbsolutePath();
                             String subTemp = temp.substring(temp.indexOf("bin")+4,temp.length());
    //                         System.out.println( subTemp+":"+fin.getChannel().size());
                             jarOutput.putNextEntry(new JarEntry(subTemp));
                             int len ;
                             while((len=fin.read(buff))>0)
                                  jarOutput.write(buff,0,len);
                             fin.close();
              catch( Exception e )
                   e.printStackTrace();
         * Method used to close the object for JarOutputStream
         public void close()
         {//This method is used to close the
              //JarOutputStream
              try
                   jarOutput.flush();
                   jarOutput.close();
              catch(Exception e)
                   e.printStackTrace();
         public static void main( String[] args )
              JarCreation jarCreate = new JarCreation("destnation path where jar file will be created /");
              jarCreate.createJar("put your source directory");
              jarCreate.close();

    Hi,
    I have gone through your code and the problem is that when you create jar it takes a complete path address (which is called using getAbsolutePath ) (when you extract you see the path; C:\..\...\..\ )
    You need to truncate this complete path and take only the path address where your files are stored and the problem must be solved.

Maybe you are looking for

  • Is this a bug in Java!

    int i=0; i=i++; System.out.println(i); What should this code print. I guess 1. But it prints 0. Can anyone explain the logic behind this, or is this a bug in Java. Thanks for your time in advance.

  • ACH Payment

    Hi All, When I am running F110, I am facing problem when generating a spool. The Spool conists of errors. The Errors is as follows: F0417                    Warning: Check whether a duplicate payment medium has been created                           

  • Lost black highlight associated to adjustment brush, radial filter, graduated filter [was: stupid problem]

    lost black highlight associated to adjustment brush, radial filter, graduated filter and actions are showing up in small navigator window

  • Help with the Update

    Any help out there on how to do the upgrade? Went thorugh tutorial, but cannot get to the prompt for the download. Message was edited by: firstpink

  • All back ground process on hold

    Dear Team, I am using ECC 6.0 with Oracle 10. When I am checking all work process via SM50. All Backgroung process show in Hold position , Reasion RFC  , Report SAPLSSXP. I have check sm37 no these jobs is active. thats the reasion. ? how i solve the