Can I place jar files inside ejb-jar.jar?

Hi,
I'm reading about the packaging rules for creating an ejb-jar.jar file, and I'm wondering whether it's possible to include a jar file (containing helper classes) inside of the ejb-jar file. A "lib" dir (for containing such helper jars) doesn't seem to be part of the ejb-jar file format.
The EJB 3 spec has this to say (Ch 20, "Enterprise JavaBeans 3.0, Final Release):
"The ejb-jar file must also contain, either by inclusion or by reference, the class files for all the classes and interfaces that each enterprise bean class and the home interfaces, component interfaces, and/or web service endpoints depend on, except Java EE and J2SE classes. This includes their superclasses and superinterfaces, dependent classes, and the classes and interfaces used as method parameters, results, and exceptions"
Now, it seems that the root of the the ejb-jar file contains all the classes (in the appropriate Java package layout). But what about including JAR files? The ejb-jar spec seems to have nothing to say about a "lib" dir that can contain jars (as a WAR file can).
Summary of questions:
1) Can an ejb-jar file contain a jar file? If so, how/where?
2) Can the ejb-jar file's META-INF/MANIFEST.MF file contain a reference to a JAR file?
I'm not considering correct design at the point... I'd just like to know if these 2 scenarios are possible.
Thank you!
kamuifx

Yes, I have an ear file..................
I have an EAR file; inside the EAR I have a WAR file (web module) and an EJB-jar file (EJB module).......... the EJB need some classes placed in a jar file (a helper .jar or an util .jar)...........
my question is: How can I use the classes of the .jar files in te EJB??????
thanks

Similar Messages

  • Including a jar file inside an executable jar file

    Is it possible to include a jar file inside another (executable) jar file such that the included file is part of the class path for the outer file? If so, how do you specify this in the classpath in the manifest?

    Russ_Bjork wrote:
    Is it possible to include a jar file inside another (executable) jar file such that the included file is part of the class path for the outer file?No. Actually, I suppose it would be possible if you do all the 'heavy lifting', but Java is not designed to handle Jars within Jars.
    What do you see as the advantage of doing that?
    Is your app. a rich client (e.g. Swing, AWT, SWT..)?
    Can you distribute the app. from a server or the internet?

  • Creating jar file including 2 another jar files

    hi
    My project has java files, properties files,batch files as well as two jar files,mail.jar & activation.jar(for importing packages).
    I have to include these jar files while setting environment variables.
    Now i want to make "MyPrj.jar" file for myproject ,can anyone pls help me how to include these all files into a single jar file. and how to make setup file
    I have tried to extract out .class files of mail.jar & activation.jar & i ve created MyPrj.jar by including all class files(including class files of mail.jar & activation.jar) but manifest file(headers) are not added to MyPrj.jar.
    i have also tried to give mail.jar & activation.jar in Class-Path of menifest file, but it is also not working.
    Pls Help
    Thanks a lot

    [http://sourceforge.net/projects/one-jar]
    "One-JAR(TM) is a simple solution to a vexing problem in Java: how to distribute an application as a single jar-file, when it depends on multiple other jar-files. One-JAR uses a custom classloader to discover library jar files inside the main jar. "

  • How to access additional supporting jar files from EJB JAR?

    Hi,
    How can we access additional supporting jar files as part of my EJB JAR .
    I don't want to keep them in the top level because other EJB JAR files also has
    the same jar files(code in the classes in the jar is slightly different)
    can I keep the additional jar files in my EJB JAR?
    Thanks
    NLB

    Include the supporting jar files in the Ejb jar file.
    Specifiy the jar files in the Ejb jar manifest file.
    Manifest-Version: 1.0 [CRLF]
    Class-Path: utility.jar [CRLF]
    thanks,
    Deepak
    "NLB" <[email protected]> wrote:
    >
    Hi,
    How can we access additional supporting jar files as part of my EJB JAR
    I don't want to keep them in the top level because other EJB JAR files
    also has
    the same jar files(code in the classes in the jar is slightly different)
    can I keep the additional jar files in my EJB JAR?
    Thanks
    NLB

  • Can't write to file when double-clicking jar...

    This issue has me stumped. I have a jar dssetup.jar... The manifest looks like the following...
    Manifest-Version: 1.0
    Main-Class: DSsetUp
    Created-By: 1.3.0_02 (Sun Microsystems Inc.)
    I also have a text file that I read and write to(this file is outside the jar):
    datasource.txt
    If I execute my jar from the command line, I can read and write to the file...no problem. However, if I double click my jar to run it, I can read the text file but cannot write to the text file. Has anyone seen this before?
    Thanks

    It is true ..
    you can not write anything to .jar file directly..
    .jar file is not a common file, it is compressed.
    the following tool give you some cue.
    tool named JavaJar(written by java) can compress and decompress jar,war, ear and.zip...
    may download from http://www.qwerks.com/download/4114/JavaJar.zip
    the tool is very verygood tool.
    but the homepage(www.pivotonic.com) of JavaJar cannot be accessed.
    it is funny.
    good lucky.

  • Jars files inside atglib folder

    HI Guys
    I am creating ear file in atg by using ant script ,inside ear file i found atglib files with some jar files different files
    from where it is picking those jar files inside atglib folder
    please give me clear picture on this

    HI David,
    Will it follow config path layering while build the ear file ?
    or do we need to provide explicitly each module to build?
    in my application i didnot find some ootb modules in build script but inside ear file those modules jar files are i am able to see
    how  it is possible ? is it because of config path layering?

  • Compress two .jar file into a new .jar file

    Hi all, i would like to ask it there anyone know how to compress two or more .jar file into one new .jar file?
    because i'm currently need to engage with one big project which have to add 34 .jar file into JCreator, so that the relevant classes can be found when compile the code.
    another question is, what is the maximum archive can be add into JCreator? is it limited or unlimited?
    So, any idea from you all?
    Regards,
    poh_cc

    You should probably ask the authors of JCreator about the limitations of it.
    The classloader can't read jars from jars and I would advice against extracting all jars and jar all classes into one big fat jar.
    Kaj

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

  • I can longer place PSD files into Illustrator. Only jpgs are working. I'm using CS4 and Yosemite. What's up?

    I can longer place PSD files into Illustrator. Only jpgs are working. I'm using CS4 and Yosemite. What's up?
    Creative Suites

    THat's a bug/ compatibility issue in Yosemite.
    Mylenium

  • Common JAR file between EJB and WAR inside an EAR

    Hi,
    I'm trying to deploy an EAR application outside the development environment and I have the following problem.
    My EAR has the following structure :
    application.ear
    |-- ejbs.jar
    |-- web.war
    Inside the WAR, in /WEB-INF/lib/, I have a set of JAR files that are used by the Web app and also, of course, by the EJB.
    During the deployment step, EJB module cannot be deployed because it miss some classes into the classpath.
    I think it is a common problem in J2EE development, so does someone has a solution for this problem ?
    Please note I'm using Macromedia JRun 4 SP1 on Windows XP.
    Regards,
    Damien.

    Ok,
    I have found a solution that seems elegant to me. I'm going to try and explain...
    My appli.jar EJB module and my appli.war Web module are using both two JAR, let's say common.jar and util.jar.
    The way to share those JAR between the two modules is to have the following structure for the EAR :
    appli.ear
      |-- appli.jar
      |-- appli.war
      |-- common.jar
      |-- util.jar
      |-- META-INF
           |-- application.xml
           |-- manifest.mfIn this structure :
    * the common.jar and the util.jar are not part of the WAR (/web-inf/lib)
    * the manifest.mf file has the following content :
    Manifest-Version: 1.0
    Created-By: My Application
    Class-Path: common.jar util.jarPlease note that space is used as separator for the classpath entry to allow independancy from OS.
    And you know what ? It works ! Well, on Macromedia JRun 4.0 SP1 and on Windows XP but I hope it works on other platforms.
    I hope it will help a lot of people because I spent a lot of time before to find a solution !
    Regards,
    Damien.

  • Problem accessing Application Ejb Jar files from Apache Axis jars

    I have deployed an EAR application, with a structure as shown below,
    MyApp.ear
    |____ MyApp_Ejb.jar
    |____ axis.war
    |_____ WEB-INF
    |_____ lib (This contains all axis specific jars)
    The application deploys just fine. But when i goto happyaxis.jsp and try to view all the web services that have been deployed. I get an exception "No provider type matches QName '{http://xml.apache.org/axis/wsdd/providers/java}SDL".
    Here SDL is a custom provider that i have written and all the required files for the provider are available in MyApp_Ejb.jar.
    I do not get as to why the axis.jar is not able to find classes in MyApp_Ejb.ear, when both these are in the same ear.
    Now i know i can add a utility jar to a war files classpath by adding a classpath line in the War file MANIFEST.MF. But since MyApp_Ejb.jar is defined as a Web Module this solution too doesnt help.
    Separating the provider related files from MyApp_Ejb.jar is not possible since there is too much dependance of other files within that jar.
    So i am looking for a solution where in i can continue to have MyApp_Ejb.jar as my ejb module as well as the axis related jars can find the required classes within MyApp_Ejb.jar. some way of sharing the ejb jar across to axis jars.
    Thanks in advance.
    Vicky

    I have deployed an EAR application, with a structure as shown below,
    MyApp.ear
    |____ MyApp_Ejb.jar
    |____ axis.war
    |_____ WEB-INF
    |_____ lib (This contains all axis specific jars)
    The application deploys just fine. But when i goto happyaxis.jsp and try to view all the web services that have been deployed. I get an exception "No provider type matches QName '{http://xml.apache.org/axis/wsdd/providers/java}SDL".
    Here SDL is a custom provider that i have written and all the required files for the provider are available in MyApp_Ejb.jar.
    I do not get as to why the axis.jar is not able to find classes in MyApp_Ejb.ear, when both these are in the same ear.
    Now i know i can add a utility jar to a war files classpath by adding a classpath line in the War file MANIFEST.MF. But since MyApp_Ejb.jar is defined as a Web Module this solution too doesnt help.
    Separating the provider related files from MyApp_Ejb.jar is not possible since there is too much dependance of other files within that jar.
    So i am looking for a solution where in i can continue to have MyApp_Ejb.jar as my ejb module as well as the axis related jars can find the required classes within MyApp_Ejb.jar. some way of sharing the ejb jar across to axis jars.
    Thanks in advance.
    Vicky

  • How to call external jar files in EJB project for CE

    Hi,
    I would be thankful if someone could help me with this -
    I need to call the external jar files into my EJB project - Here is what I have done and am getting runtime exception as  -
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    1. Created a EJB  project" HelloWorld "  using Java perspective in NWDS 7.1 called with client as HelloWorldClient and EAR project as HelloWorldEAR.
    2. Am working on HelloWorld project (1st one).
    3. In my code I am instantiating a class which is a class in one of  the external jar file that I need to refer in my project.
    4. I have set the Java Build path but it works only for the compile time and fails during runtime.
    5. Have read I need to create external library DC and refer in my project "HelloWorld".
    Can anyone help me with exact steps what needs to be done - during creation of external library project and then for my "HelloWorld" EJB project. How would I be able to reference or set the external library project in my EJB project?
    Looking forward to hear from experts.
    Thanks,
    Shiv
    Edited by: Shiv Khullar on Aug 30, 2010 9:39 PM

    Hi Edson,
    I tried it , but it still gives me runtime exception.
    javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    Steps I performed are -
    1. Created a library project and created 2 Public parts "Compilation" and "Assembly"
    2. Build the library project.
    Now in my EJB project using Project Explorer - set the classpath and added both compilation jar and assembly jar files.
    This is how the classpath entries for external library looks like -
    <classpathentry kind="lib" path="/LocalDevelopmentLocalDevelopmentexternallibrarypdftoolsforwatermarkingdemo.sap.com/gen/default/public/WatermarkAssembly/lib/java/demo.sap.comexternallibrarypdftoolsforwatermarking~WatermarkAssembly.jar"/>
         <classpathentry kind="lib" path="/LocalDevelopmentLocalDevelopmentexternallibrarypdftoolsforwatermarkingdemo.sap.com/gen/default/public/WatermarkCompilation/lib/java/demo.sap.comexternallibrarypdftoolsforwatermarking~WatermarkCompilation.jar"/>
    I have also added the jar files I used in my external library project as "User Library" from Java Build Path . I dont do it , then the code fails during compilation itself.
    Regards,
    Shiv

  • Jar files for EJB using tomcat

    hi,
    Am using eclipse . I am getting an error the declared package does not match the expected package while compiling the ejb.Can anyone tell me what are the jar files I need to include in classpath for eclipse

    Hi Adam,
    I have created a New EJB Project for my proxy development. This is the usual way I develop proxies for any given service interface created in ESR. Now i am not sure how to create  a dependency with the BRMS facade. If i find the jars i can add it as an external library when compiling.
    Can you explain a bit more about what you ment by "developing the java proxy in a development component", how did you accomplish this when creating a proxy for a service interface?
    http://help.sap.com/saphelp_nw73ehp1/helpdata/en/e2/3620cef55842cca4632664212f31b1/content.htm?frameset=%2Fen%2F81%2F097529e0e545e58bb2d7a34e4d0a2a%2Fframeset.htm

  • Creating jar file for EJB

    Can anybody tell me how to make the jar file to deploy an EJB in websphere??

    There are many ways.
    You can use Ant to build your Jar file, but you need to construct your ant build file.
    Or make your EJB in an exploded directory structure and then use Jar utility like
    jar -cvf xxxx.jar.
    or if you are using WSAD, it will construct everything for you. But you need to do some additions in the deployment descriptor.

  • How to use methods from a JAR file inside my springcontext (Oracle fusion 12c) class file?

    Dear Friends,
    I have a jar file, which has executed classes and methods in it. I want to make use of these methods inside my springcontext piece of code.
    Can someone please share an example  of how to write spingcontext code which is accessing classes/methods from  JAR files along with the any setup?
    Thanks,

    I have found the answer... as described in:
    http://java.sun.com/javase/6/docs/technotes/guides/lang/resources.html
    the problem was that the properties are loaded with the getResource & getResourceAsStream methods and I didn't know that one. I thought that is was loaded through findClass because I saw the property files trying to be loaded through findClass.
    The truth is that it tries to load with the getRessources methods and if it fails tries with the findClass/loadClass.
    To Fix the problem, I have simply overriden the getRessourceAsStream to do my magic and that was it.
    Thanks

Maybe you are looking for

  • When I copy and paste text into Captivate 8, special characters disappear

    I'm trying to copy and paste text from a PDF into Captivate 8. When I paste, all the accent marks disappear. (for example: ê shows up as e). I've tried pasting into other applications, and the special characters paste correctly, so it's a Captivate

  • How do you restore a passport ilibrary file to a Mac iPhoto directory?

    My objective was to move photos and movies to an external hard drive.  I was successful in moving DVD projects.  Now I have movies that it cannot find some the pictures and clips which are in iPhoto events.  I probably messed up by moving iPhoto even

  • Newbie help -convertng an ACL

    I'm new to Java and programming in general so forgive me. I need to get the ACL from a Lotus Notes database and convert it to a text file and so it can be used as an .htaccess file on our apache server. I know this is probably very simple, but I'm ha

  • HT204406 Songs in "waiting" mode for months.

    I started iMatch back at the beginning of the year. I have two songs that have been in "waiting" mode (not "ineligible") all these months. Why will these two songs not upload? The rest of the 10,500 songs all uploaded or "matched" properly. There is

  • Image Links property, what's the deal?

    I have several Image viewer elements in my site, and even though I've specified NO image link URL, when clicking images, it tries to go to macromedia.com See attached code. Rich