Ear, war and jar question.

Hi Communtiy,
Can I split an ear file to a war file on one computer and to a jar file on an other computer, or doesnt it makes sense.
Thanks
Oliver.

we can....I am not sure in which circumstances you need this.
There are no structural differences between the files; they are all archived using zip/jar compression. However, they are intended for different purposes.
Jar files (files with a .jar extension) are intended to hold generic libraries of Java classes, resources, auxiliary files, etc.
War files (files with a .war extension) are intended to contain complete Web applications. In this context, a Web application is defined as a single group of files, classes, resources, .jar files that can be packaged and accessed as one servlet context.

Similar Messages

  • Are JDev autogenerated paths needed to create ear, war and jar files ?

    Hi
    We want to create ear, war and jar files from Ant build script generated from JDeveloper 11.1.1.7.
    We also like to use ojdeploy with it.
    In the process of creating build.xml files from projects, we see these paths.
    We also have standalone Weblogic installed with ADF runtime 11.1.1.7
    Questions:
    1- Do we need these path ids to generate ear, jar, war files properly and then deploy the ear to our standalone Weblogic so that our webapp can run ok ?
    2- Why are they generated, if they are not needed
    From research, it appears that we don't need these paths except to keep ant targets of init, compile, exec etc with ojdeploy.
    3- Is that true ?
    We are afraid that because no paths are listed in the build.xml, then when we deploy the ear app, it cant use the ADF runtime on the standalone WLS.
    Thanks in advance for answering.
    Sincerely
    eg of paths generated below:
      <path id="library.SOA.Designtime"/>
      <path id="library.SOA.Runtime"/>
      <path id="library.BPEL.Runtime"/>
      <path id="library.Mediator.Runtime"/>
      <path id="library.MDS.Runtime">
        <pathelement location="{oracle.middleware}/oracle_common/modules/oracle.mds_11.1.1/mdsrt.jar"/>
      </path>
      <path id="library.BC4J.Service.Runtime">
        <pathelement location="{oracle.middleware}/oracle_common/modules/oracle.adf.model_11.1.1/adfbcsvc.jar"/>
        <pathelement location="{oracle.middleware}/oracle_common/modules/oracle.adf.model_11.1.1/adfbcsvc-share.jar"/>
        <pathelement location="{oracle.middleware}/oracle_common/modules/commonj.sdo_2.1.0.jar"/>
        <pathelement location="{oracle.middleware}/modules/org.eclipse.persistence_1.1.0.0_2-1.jar"/>
        <pathelement location="{oracle.middleware}/oracle_common/modules/oracle.webservices_11.1.1/wsclient.jar"/>
        <pathelement location="{oracle.middleware}/oracle_common/modules/oracle.web-common_11.1.1.jar"/>
      </path>
      <path id="library.TopLink">
        <pathelement location="{oracle.middleware}/modules/com.oracle.toplink_1.0.0.0_11-1-1-5-0.jar"/>
        <pathelement location="{oracle.middleware}/modules/org.eclipse.persistence_1.1.0.0_2-1.jar"/>
        <pathelement location="{oracle.middleware}/modules/com.bea.core.antlr.runtime_2.7.7.jar"/>
        <pathelement location="{oracle.middleware}/modules/javax.persistence_1.0.0.0_2-0-0.jar"/>
      </path>
      <path id="library.Oracle.Rules"/>
      <path id="classpath">
        <path refid="library.SOA.Designtime"/>
        <path refid="library.SOA.Runtime"/>
        <path refid="library.BPEL.Runtime"/>
        <path refid="library.Mediator.Runtime"/>
        <path refid="library.MDS.Runtime"/>
        <path refid="library.BC4J.Service.Runtime"/>
        <path refid="library.TopLink"/>
        <path refid="library.Oracle.Rules"/>
      </path>

    There are two different things here. Using ant to build the class files and then building an ear from the class files and other resources.
    The building part needs the libraries if you use javac as compiler. Building an ear file only needs the path to the jar files which are packed into the ear.
    In this sense you need the pages you see in the build.xml.
    Then Jdev offers another way: ojdeploy. This tool is a Jdev without a gui.
    You can use this tool and build the classes for each project of a workspace and to build build war and ear file. This is just like you click the rebuild button for each project and then the deploy the projects and application. If you use this approach you don't need the generated path ids as the whole build process is done inside Jdev as it's done on your developer pc.
    Timo

  • Ears, wars, support jars, and CLASSPATH

    I am trying to migrate an application from WLS 5.1 to 6.1. There are 25
    EJB jars with an equal number of support jars, most of which are referenced
    by multiple EJBs. There are also a large number of jsps, and html pages.
    I have tried packaging an ear that contains the 25 ejb jars, a war file
    containing the web pages. I have attempted to include the support jars in
    the ear as well.
    In all attempts, the only way I get class references sastisfied is to
    include all the jars on the system CLASSPATH. But this defeats the purpose
    of packaging, since none of the components referenced in the system
    CLASSPATH will be re-deployable.
    The online documents refer to separate class loaders and classpaths for the
    war and ejbs, but no detail as to how classes are found by the loaders.
    Unless I put all the jars into the CLASSPATH, jsp pages cannot reference the
    EJBs, and EJBs are unable to reference other EJBs.

    Thanks,
    Now if I could just get Webgain Visual Cafe to allow me to include the
    Classpath entries in the generated manifests for the EJB jars.
    "Gregory Gerard" <[email protected]> wrote in message
    news:3ba24da1$[email protected]..
    You need to mangle all the Manifest files within the EAR and EJB-JARs and
    WAR to get the right thing to happen. Check out this PDF on Sun's site:
    http://java.sun.com/j2ee/j2ee-1_3-pfd4-spec.pdf
    section 8.1.1.2
    I don't entirely understand all the restrictions and formatting -- Ihaven't
    found an example ear file out there that implements a non-trivial case.
    greg
    "Carl Lawstuen" <[email protected]> wrote in message
    news:3ba21d8e$[email protected]..
    I am trying to migrate an application from WLS 5.1 to 6.1. There are
    25
    EJB jars with an equal number of support jars, most of which arereferenced
    by multiple EJBs. There are also a large number of jsps, and htmlpages.
    I have tried packaging an ear that contains the 25 ejb jars, a war file
    containing the web pages. I have attempted to include the support jarsin
    the ear as well.
    In all attempts, the only way I get class references sastisfied is to
    include all the jars on the system CLASSPATH. But this defeats thepurpose
    of packaging, since none of the components referenced in the system
    CLASSPATH will be re-deployable.
    The online documents refer to separate class loaders and classpaths forthe
    war and ejbs, but no detail as to how classes are found by the loaders.
    Unless I put all the jars into the CLASSPATH, jsp pages cannot referencethe
    EJBs, and EJBs are unable to reference other EJBs.

  • Packaging of EAR / WAR / EJB-JAR

    Hello,
    I have a big application to do.
    So, one solution should be to use an EAR for one module, containing the WAR for the web-tier and the EJB-JAR for the business-tier.
    It would be better doing like this than creating a big WAR, in order to avoid to deploy a big WAR when a modification is done in one module.
    What about the problem of the session ?
    In fact, I have to declare a context-root for one EAR.
    And at each context-root is created an object HttpSession on the server.
    So, I have some questions about this :
    - How can I configure my WARs in order to use only one HttpSession object for every WARs ?
    - Can I put multiple WARs in one EAR ? If yes, what about the context-root ? This solution would resolve the session problem.
    Thanks in advance.
    bgOnline

    Hello,
    I have a big application to do.
    So, one solution should be to use an EAR for one
    module, containing the WAR for the web-tier and the
    EJB-JAR for the business-tier.
    It would be better doing like this than creating a
    big WAR, in order to avoid to deploy a big WAR when a
    modification is done in one module.Are you using local EJBs or remote EJBs? The only way for a war to talk to a local EJB is to package the war along with the ejb-jar in an EAR file because they need to be collocated. You can not simply bundle EJB classes in a war file.
    If you are using remte EJBs, then you can package the EJB client view classes along with the servlets and JSPs in the war file and deploy the war separately. But again your war will be one big war.
    If your EJBs are just entity beans, then Java EE 5 (see http://weblogs.java.net/blog/ss141213/archive/2005/12/using_java_pers.html) allows you some nice options.
    >
    What about the problem of the session ?
    In fact, I have to declare a context-root for one
    EAR.
    And at each context-root is created an object
    HttpSession on the server.
    So, I have some questions about this :
    - How can I configure my WARs in order to use only
    one HttpSession object for every WARs ?
    There is no standard way to do this. Relying on any application server specific feature can only make your app non-portable. So I strongly recommend you not to do this.
    - Can I put multiple WARs in one EAR ?Of course you can.
    If yes, what about the context-root ? This solution would resolve
    the session problem.Can't be solved using any standard way. So I suggest you stick to one big war, if that's what your business requirement is.To speed up development-deployment-test cycle, any appserver allows a rapid deployment option where in you can deploy incremental changes to server. Use this facility during development. DON'T sacrifice portability of your app by using any product specific configuration that you may not find any where else.
    Thanks,
    Sahoo

  • Question about ear file and jar file

    I have an ear file that I built using ant. Say my project name is test. So my ear file name is test.ear. Everytime I try to deploy the ear file, weblogic complains about not finding the test-ejb.jar. I'm confused as to why weblogic expects a test-ejb.jar in the ear because I didn't intend to put one in. My question is whats inside the ear file that weblogic thinks it needs the test-ejb.jar? I went through the file, but couldn't find anything that should tell weblogic that it should find a test-ejb.jar. In addition, I don't have either weblogic-ejb-jar.xml or ejb-jar.xml in the ear file. Any help would be appreciated.
    Thanks in advance.

    An EAR should have an "application.xml" in the META-INF directory within the JAR. You might take a look at it. I suspect there is an EJB module specified by that name.

  • Unable to run war and jar when both deployed on the same server

    hi,
    i getting errors viz,(LogInterceptor,EJBException in method(bean classes).ihave deployed jar successfully on the Jboss server4,and i am able to excute a simple jsp file (which call the bean from jboss) from Tomcat server where i have put my client file.But if i try to put both the same war file in the jboss and then try to excute .It doesn't execute but pops above error .What is the reason????

    Stack trace please.

  • How to structure a JSF application (EAR/WAR/JAR)

    Hi All,
    How do you recommend I should structure a JSF application in terms of EARs, WARs and JARs?
    Let me set the context for you: I have a fairly large project which consists of a number of sub components. Each of these sub components are JSF applications in the sense that they have JSF pages connected to each other. So, for instance, I have a company management sub component and a product management subcomponent. Most of these sub components share some Java libraries and/or entities.
    Because of this I decided to have each sub component contained in its own WAR, with no universal libraries in its lib folder, and to then add these WARs to an EAR with all the library JARs in the EAR's lib folder, as so:
    EAR
       |_ component1.WAR
       |_ component2.WAR
       |_ lib
             |_ sharedlib1.JAR
             |_ sharedlib2.JARUnfortunately I'm having more problems than I hoped I would with JSF with this setup. An alternative I have is to create one gigantic WAR which contains all the library archives and then to only deploy this WAR. Although this would probably work, it destroys the nice seperation I had between sub components, where I could for instance just remove the one WAR from the EAR if it was giving problems. That structure would look something like this:
    WAR
       |_ <WebContent>
       |_ WEB-INF
                 |_ classes
                           |_ <JSF classes>
                 |_ lib
                        |_ sharedlib1.JAR
                        |_ sharedlib2.JARFinally, I have a third option where I add all the libraries required by a WAR to its lib folder and I have no shared libraries in the EAR's lib folder. The disadvantages are of course that the EAR will be huge as JARs get duplicated unnecessarily, and I'm not sure that this won't cause conflicts. The structure would look like this:
    EAR
       |_ component1.WAR
                        |_ WEB-INF
                                  |_ lib
                                        |_ sharedlib1.JAR
                                        |_ sharedlib2.JAR
       |_ component2.WAR
                        |_ WEB-INF
                                  |_ lib
                                        |_ sharedlib1.JAR
                                        |_ sharedlib2.JARI believe the first way to be the best, but I'm struggling getting JSF to work like I expect (see [http://forum.java.sun.com/thread.jspa?threadID=5288069|http://forum.java.sun.com/thread.jspa?threadID=5288069] ). What are your suggestions?
    Thank you,
    Ristretto

    Dear hiwa,
    thank you very much for your response. I have had a look into the book and found out that it provides indeed half of the solution i need. Now I can generate a JSF response to my non-JSF request which has been issued by the main application.
    Unfortunately this is only the first half of the solution, because the JSF framework of the child application will still render URIs into HTML-forms (e.g. for the <f:view>) that point to the faces servlet and not to the non-JSF servlet of the main application.
    I'll try to solve this problem by providing my own ViewHandler that provides other URIs. But I still don't know how to encode the view ID into the generated HTML-form as a hidden field.
    After all, I am really surprised at how difficult it is to integrate the JSF framework into a non-JSF application. I don't think this is a very uncommon scenario. In my case, we integrate into an existing large application of our customer in order to extend his application with our product. I would expect this to work out of the box with JSF (sigh).
    I will post my progress in this matter if I found some interesting solution.
    Bye, Marcus

  • How to deploy ear file with jar file and war file with different names

    Hi,
    As part of weblogic migration from WL 6.1 sp3 to WL 10, Iam facing some problem.
    Problem:
    I have one ear file(abc.ear) to deploy which contains one jar file(xyz.jar) and one war file(pqr.war).
    In config.xml file of WL 6.1, it was mentioned as :
    <Application Deployed="true" Name="abc" Path="./config/mydomain/applications/abc.ear">
    <EJBComponent Name="xyz" Targets="myserver" URI="xyz.jar"/>
    <WebAppComponent Name="pqr" Targets="myserver" URI="pqr.war"/>
    </Application>.
    The above is working fine.
    But in config.xml file WL10,I cannot mention the same.
    I need to have different application anmes for ear,jar and war.If I deploy as a ear file,the jar and war files are deployed with the same ear file name.
    I tried the following options:
    1) Deploying as a ear file by adding <sub-deployments>
    2) Deploying both war and jar seperately which is not recommended in my application.
    Please provide the content I should place in the config.xml so that everything works fine correctly.
    Any help is appreciated.

    Hi,
    As part of weblogic migration from WL 6.1 sp3 to WL 10, Iam facing some problem.
    Problem:
    I have one ear file(abc.ear) to deploy which contains one jar file(xyz.jar) and one war file(pqr.war).
    In config.xml file of WL 6.1, it was mentioned as :
    <Application Deployed="true" Name="abc" Path="./config/mydomain/applications/abc.ear">
    <EJBComponent Name="xyz" Targets="myserver" URI="xyz.jar"/>
    <WebAppComponent Name="pqr" Targets="myserver" URI="pqr.war"/>
    </Application>.
    The above is working fine.
    But in config.xml file WL10,I cannot mention the same.
    I need to have different application anmes for ear,jar and war.If I deploy as a ear file,the jar and war files are deployed with the same ear file name.
    I tried the following options:
    1) Deploying as a ear file by adding <sub-deployments>
    2) Deploying both war and jar seperately which is not recommended in my application.
    Please provide the content I should place in the config.xml so that everything works fine correctly.
    Any help is appreciated.

  • Deployment problems EAR & WAR

    I have serious problems deploying an EAR, containing 25 ejb-jars and 3 wars.
    The history of the project is that it was first developed on WLS 4.5 & 5.1. We
    have later moved to Orion were the actual development takes place. Now we can
    run the application on Orion and WLS 5.1. We now want to deploy the application
    on WLS 6.1 sp 2. We have setup the whole application to be deployed as one EAR,
    this works fine with Orion. The whole building is made in Ant.
    I'm new on WLS 6.1 but have worked a lot on WLS 5.1 and 4.5 (I think it was).
    I might have missed something but the documentation on EAR is very short.
    When I first deploy the EAR, it seemed to work fine according to the console,
    however when I tried to access servlets or JSPs, they simply weren't there (Error
    404--Not Found). When I deployed the EAR from the console I got a number of zipexceptions.
    After asking around, I was recommended to remove the compression in the jar,war
    & earfiles. When I did that I got a number of errors in static initializers in
    EJBs, which indicated that the EJBs actually were deployed. I fixed those and
    the application was deployed without errors (when I start WLS and the EAR is deployed
    by being in the config.xml file). Still when I deploy it from the console it still
    throws ZipExceptions.
    Anyway now I can access one of the war files but the other is not there. The deployed
    war file is a lot smaller than the one not being deployed.
    I think that all settings in application.xml, web.xml etc is correct. I'm also
    confident that modules are correct, it does work in Orion, which has similar classloading.
    From other developers, I have heard that I need to use WLS 6.1 sp 2, no compression
    and that I have to break up large EARs in smaller (my EAR is 6,5 MB) files.
    What really annoys me that I do not seem to get any errors, logs or anything.
    The console indicates that everything is deployed even if apparently is not.
    And I can deploy PerStore and everything works. If I deploy the wars, and ejbs
    from the console (one at a time), it works.
    I would appreciate any help on this subject any workarounds etc. I think that
    I have to skip my first intent and deploy an exploded EAR instead of having (almost)
    the same deployement as in Orion, which kind of pisses me of. I am also disappointed
    that BEA has apperantly skipped java-modules all together. It is after all in
    the specification.
    I have talked to a number of people and they say that the whole EAR deployment
    in WLS is very shaky. Is this true?
    Thanks in advance,
    Erik Romson

    EAR deployment works fine from my own experience. Use JAR and turn off
    compression for the WARs and JARs and the EAR itself, although I've never
    seen a ZIP exception and I use JAR and ZIP and Winzip and whatever else I
    can grab to muck with the files. 6.5MB is not tiny, but it isn't very large
    either -- WL can handle much bigger EARs. Normally we don't suggest having
    so many JARs and WARs in the EAR, but that is more preference ... are you
    using manifest class path? ... are you referring to any of the files in the
    WARs from any of the classes in the JARs?
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "Erik Romson" <[email protected]> wrote in message
    news:[email protected]...
    >
    I have serious problems deploying an EAR, containing 25 ejb-jars and 3wars.
    The history of the project is that it was first developed on WLS 4.5 &5.1. We
    have later moved to Orion were the actual development takes place. Now wecan
    run the application on Orion and WLS 5.1. We now want to deploy theapplication
    on WLS 6.1 sp 2. We have setup the whole application to be deployed as oneEAR,
    this works fine with Orion. The whole building is made in Ant.
    I'm new on WLS 6.1 but have worked a lot on WLS 5.1 and 4.5 (I think itwas).
    I might have missed something but the documentation on EAR is very short.
    When I first deploy the EAR, it seemed to work fine according to theconsole,
    however when I tried to access servlets or JSPs, they simply weren't there(Error
    404--Not Found). When I deployed the EAR from the console I got a numberof zipexceptions.
    After asking around, I was recommended to remove the compression in thejar,war
    & earfiles. When I did that I got a number of errors in staticinitializers in
    EJBs, which indicated that the EJBs actually were deployed. I fixed thoseand
    the application was deployed without errors (when I start WLS and the EARis deployed
    by being in the config.xml file). Still when I deploy it from the consoleit still
    throws ZipExceptions.
    Anyway now I can access one of the war files but the other is not there.The deployed
    war file is a lot smaller than the one not being deployed.
    I think that all settings in application.xml, web.xml etc is correct. I'malso
    confident that modules are correct, it does work in Orion, which hassimilar classloading.
    >
    From other developers, I have heard that I need to use WLS 6.1 sp 2, nocompression
    and that I have to break up large EARs in smaller (my EAR is 6,5 MB)files.
    >
    What really annoys me that I do not seem to get any errors, logs oranything.
    The console indicates that everything is deployed even if apparently isnot.
    >
    And I can deploy PerStore and everything works. If I deploy the wars, andejbs
    from the console (one at a time), it works.
    I would appreciate any help on this subject any workarounds etc. I thinkthat
    I have to skip my first intent and deploy an exploded EAR instead ofhaving (almost)
    the same deployement as in Orion, which kind of pisses me of. I am alsodisappointed
    that BEA has apperantly skipped java-modules all together. It is after allin
    the specification.
    I have talked to a number of people and they say that the whole EARdeployment
    in WLS is very shaky. Is this true?
    Thanks in advance,
    Erik Romson

  • Difference between .jar, .war and .ear file

    Hi,
    I am pretty new to J2EE technology.
    I would like to know what is the difference between .jar, .war and .ear files and how they are deployed on webserver.
    Thanks,

    Files with a .jar extension or JAR files, are essentially just a collection of files compressed using the ZIP/ZLIB compression format.
    JAR (short for Java Archive) files were introduced in the early days of Java as a means to conveniently package and distribute Java applications and components. Since then, a number of additions to the Java platform have followed suit. The introduction of the EAR file is one such addition.
    An EAR (Enterprise Archive) file is a JAR file that contains a J2EE application.
    A J2EE application is a group of Web modules that collectively perform as a single entity.
    A Web Module is an entity consisting of one or more resources such as HTML files, Java class files, XML files, etc. Web Modules are packaged in Web Archive (WAR) files.
    Looking at it from a top-down view, EAR files contain JAR files and WAR files. Packaging resources in WAR files, JAR files and eventually EAR files, makes it easy to reuse and reassemble components as new J2EE applications and distribute them to new environments.
    For example, Tomcat deals only with WAR files.
    So, in order to auto-deploy a Web application to a Tomcat environment, you must place an application's WAR file in the appropriate directory or use Tomcat's deployment tools to manually deploy the file.
    If you already have an EAR file that contains the WAR file, you can extract the WAR file and use it as is. If you do not have the EAR file or the WAR file, you can use any number of compliant tools to create the WAR file. Tomcat is a servlet/JSP container available from the jakarta.apache.org site.

  • Classloading [EAR] - [webapp.war+ejb.jar]

    Hi.
    I've got a problem with the classloader hierarchy in WL 6.0.
    When I deploy my war/ejb application as an EAR, everything works fine.
    But I want (for several reasons) to deploy
    EJB jars and WebApp wars (or exploded Web Apps) seperately.
    WL 6.0 EJB classloader doesn't export remote/home interfaces and
    helper classes,
    so my web app can't find them.
    When I include that interfaces/classes in my Web App, I get
    occasionally ClassCastExceptions (I assume depending on classloader
    caching).
    Is there a way to configure the classloader hierarchy, or do you have
    any other solution for this?
    Thanks,
    Roman

    Hello,
    I have a big application to do.
    So, one solution should be to use an EAR for one
    module, containing the WAR for the web-tier and the
    EJB-JAR for the business-tier.
    It would be better doing like this than creating a
    big WAR, in order to avoid to deploy a big WAR when a
    modification is done in one module.Are you using local EJBs or remote EJBs? The only way for a war to talk to a local EJB is to package the war along with the ejb-jar in an EAR file because they need to be collocated. You can not simply bundle EJB classes in a war file.
    If you are using remte EJBs, then you can package the EJB client view classes along with the servlets and JSPs in the war file and deploy the war separately. But again your war will be one big war.
    If your EJBs are just entity beans, then Java EE 5 (see http://weblogs.java.net/blog/ss141213/archive/2005/12/using_java_pers.html) allows you some nice options.
    >
    What about the problem of the session ?
    In fact, I have to declare a context-root for one
    EAR.
    And at each context-root is created an object
    HttpSession on the server.
    So, I have some questions about this :
    - How can I configure my WARs in order to use only
    one HttpSession object for every WARs ?
    There is no standard way to do this. Relying on any application server specific feature can only make your app non-portable. So I strongly recommend you not to do this.
    - Can I put multiple WARs in one EAR ?Of course you can.
    If yes, what about the context-root ? This solution would resolve
    the session problem.Can't be solved using any standard way. So I suggest you stick to one big war, if that's what your business requirement is.To speed up development-deployment-test cycle, any appserver allows a rapid deployment option where in you can deploy incremental changes to server. Use this facility during development. DON'T sacrifice portability of your app by using any product specific configuration that you may not find any where else.
    Thanks,
    Sahoo

  • Ear or war or jar not created

    1. when I build the examples, it builds the class files but does not create
    ear or war files....
    2. how do I stop the default service and run the example server... the
    beasvc is not in the service list...... just have to kill in the task
    manager??
    Thx

    Java ARchive (JAR) files contain Java classes and Enterprise JavaBeans.
    Web Application Archive (WAR) files contain servlet Java code, libraries used by the servlets and possibly static content such as HTML files and JPEGs.
    Enterprise Application Archive (EAR) files contain JAR files (EJBs) and WAR files (Servlets).
    I hope that answers your question. :)
    For more detailed information have a look at the Enterprise JavaBeans Specification and the Servlet Specification:
    http://java.sun.com/products/ejb/docs.html
    http://java.sun.com/products/servlet/2.2/

  • List the contents of jar, ear, war files

    Hi All,
    It has been several years since I have worked in java and now I am trying to get caught back up :-).
    My question is: Is there a standard utility that can dump/list the contents of the packaging files: jar, ear, war?
    Thanks in advance!

    You can use winzip. OR you can use the jar command provided in JDK.
    jar -tvf <<your archive (jar, war, ear)>>

  • Extracted ear/war/jar file location in JBoss

    How can I find out in runtime where JBoss extracted my ear/war/jar file?
    I have a file inside my ear/war/jar file and I need to know the location of the file. I know that it is in the tmp/deploy directory but I need the exact application temporary name.

    You can take out the common classes and bundle them in a jar library that can be bundled directly in APP-INF/lib (or library directory defined by <library-directory> in applicaton.xml if you are using JEE5 / WLS 10). Is it possible to do this re-arragement?

  • Putting unix utility visible version info into ear, war, jar files?

    I would like to be able to use some unix utility (or java itself without a separate program) to display my version information for jar-like artifacts: ear, war, jar.
    In other words, when I build one of these things, I'd like to put my SVN version, date, user name, and maybe some other stuff into it in a way that can be read without a custom program. This needs to be done as part of the ant build (without requiring a custom java program).
    For example, one approach would be "strings | grep <special-string>" if I could put something, somewhere in the file that had this as 8-bit character encoding.
    For jars, making the jar executable and having the main print it out works, but I don't think that's do-able for ears and wars, and it would be desirable to have a consistent approach.
    Anyone already doing this?
    Ideas?

    For example, I don't think you can specify a mainline in the manifest of an ear or war.
    They have pretty strictly defined formats, and I don't want to risk violating a standard by tinkering outside the standard.Possible, but you can always run it as java -cp myWar.war my.utility.Version.
    There may be another possibility, but I'm unable to find any reference though:
    In my early Java days, I used to work on a system where there was a Unix utility (called something like +"ident"+) that was able to extract version and description info stuffed in a .so file (under which "standard" or proprietary format was the info stored, I don't know).
    I used to see it work on individual Java .class files too (from memory we had to put a String constant name "VERSION" in the class) and maybe jar files (I'm unsure).
    One of my co-workers at that time had described that as a standard tool, but "ident" turns up nothing of that kind on Google... And I've never since encountered any description of the "VERSION" constant naming convention...
    I was young and naive, I hope I were not bluffed by some alias in a custom setup... :o(
    Edited by: jduprez on Feb 18, 2010 11:30 AM
    OK a bit more reserah turned up [that man page|http://man-wiki.net/index.php/1:ident]. Apparently ident is part of RCS (installed along with CVS), and works by grepping the target file for patterns such as "$keyword: text $" (which is RCS/CVS keyword substitution pattern). Now that it mentions it, I remeber that that's what we put into our VERSION constant's value ("$version : ...$", or something of that kind).
    So:
    1) it's not so standard after all, you have to install the rcs package on the target host (regardless of whether you use RCS for configuration management, which would probably be a bad idea nowadays)
    2) you have to put such formatted strings somewhere in your code or configuration files (easy with Ant, if not genuinely through Subversion)
    3) To have it work on jar, war, ear, files, you have to make sure that the file is not compressed (otherwise the pattern might not appear in clear). I don't know whether that's easy to configure using Ant's jar, war, ear tasks.
    A bit of a hassle compared to stuffing your own utility class and using java -cp...

Maybe you are looking for