Structure of an Ear file

I'm having a little trouble trying to understand the structure of an Ear file. How are EJBs best deployed? For example if I have a bunch of beans (20-30 for instance) each having dependancies on eachother and different transactional attributes how do I package them? Is it a good idea to put each bean in its own jar and put all the jars in an Ear? Also say I do have this scenario with 20-30 jars in an Ear. Should I stick them right in the root of the Ear? If so where do I put library jar files like Java Mail and FTP suppport jars? Is there a lib folder (like there is in war files)?
If I forego the idea of separate jar files for each EJB, how would I managed the deployment descriptors for all of them? Would I create one giant DD listing all of the beans? This just feels innefficient. Can someone point me down a good path?
Thanks in advance,
Cliff

Thank you. I was confused as I thought that there might be a special lib folder as there is in WAR files. So all utility jar files like JDBC drivers and such go right in the root with EJB jars? I'll try that and see if it works.

Similar Messages

  • Building EAR files

    Hello,
    I want to build a ear-file containing several EJB jar files (one ejb in each jar-file)
    and some utility classes needed by the ejbs in a utility.jar. No webbapps.
    * How do I do this? Is there a special tool or do I just use the usual jar?
    * Is there some guide or help somewhere in the documentation?
    * How should the structure of the ear-file look like? Are any extra xml-files
    needed (except those in the ejb jar-files)?
    Best Regards,
    Anders Thornberg

    Basically just put the jar files in a directory with the application.xml
    file and let the jar program rip!
    "jar -cvf MyFile.ear ."
    Mike
    "Anders Thornberg" <[email protected]> wrote in message
    news:3b1f570e$[email protected]..
    >
    Hello,
    I want to build a ear-file containing several EJB jar files (one ejb ineach jar-file)
    and some utility classes needed by the ejbs in a utility.jar. No webbapps.
    * How do I do this? Is there a special tool or do I just use the usualjar?
    >
    * Is there some guide or help somewhere in the documentation?
    * How should the structure of the ear-file look like? Are any extraxml-files
    needed (except those in the ejb jar-files)?
    Best Regards,
    Anders Thornberg

  • I have a created a directory structure ias\ias-samples\myapps\src\docroot.In docroot folder i have a single jsp.i created a war file having that jsp,and ear file having the war file

    I deployed the ear file.Now i try calling http://localhost/myapps/test.jsp ??
    i'm i doing the right thing ?

    Hi,
    This is right provided you have installed the webserver & app server
    on the same machine and the port number for the web server is 80 by
    default.
    Regards
    Raj
    Arif Khan wrote:
    I have a created a directory structure
    ias\ias-samples\myapps\src\docroot.In docroot folder i have a single
    jsp.i created a war file having that jsp,and ear file having the war
    file
    I deployed the ear file.Now i try calling
    http://localhost/myapps/test.jsp ??
    i'm i doing the right thing ?
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • EAR file structure

    Hey all!
    Could you tell me what the ear structure is. In particular I'm interested where
    the classes that use the ejb and are used by the ejb should go??? Although we're
    not on weblogic (we're on WAS 4.0) ear structure is J2EE standart, but I went
    through the J2EE spec that I downloaded from Sun and couldn't find anything on
    the .ear file format. Heeeellp! :)

    http://edocs.beasys.com/wls/docs70/programming/packaging.html#1068120
    Dave wrote:
    Hey all!
    Could you tell me what the ear structure is. In particular I'm interested where
    the classes that use the ejb and are used by the ejb should go??? Although we're
    not on weblogic (we're on WAS 4.0) ear structure is J2EE standart, but I went
    through the J2EE spec that I downloaded from Sun and couldn't find anything on
    the .ear file format. Heeeellp! :)

  • How do I convert an war file to ear file, deploying weblogic apps

    Problem Description: I have a war file from a legacy application that needs to be migrated to weblogic. To migrate this application to weblogic, we need a ear file. Reading weblogic doc. it says we needs to use ant utility on an exploded web content application folder/ directory to create the ear file. I need to covert the existing war file to ear file , if it is doable or create one from the scratch. I need to know how to do that in weblogic. Please let me know if you have any hints .
    Thanks

    HI,
    Please try the following to convert your WAR file into an EAR exploded archieve:
    *1).* Create a Directory in your file system.
    Example:
    /home/apps/MyFirstEAR
    *2).* Place the WAR file inside the above Directory. (Suppose your WAR file name is test.war)
    Example:
    /home/apps/MyFirstEAR/test.war
    *3).* Now create a "META-INF" directory inside "/home/apps/MyFirstEAR" directory
    *4).* Now create an "application.xml" file like following inside "/home/apps/MyFirstEAR/META-INF" directory:
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.4">
    <description>Test EAR Example</description>
    <display-name>TestEAR Example</display-name>
    <module>
    <web>
    <web-uri>test.war</web-uri>
    <context-root>test</context-root>
    </web>
    </module>
    </application>
    *5).* Your EAR is ready now you can deploy the "MyFirstEAR" directory in the WebLogic Server.
    NOTE: if you want to place the "test.war" file also as an exploaded format content inside the EAR then you need to extract the test.war file and then in place of the test.war you can have "test" directory at the same place.
    You need to change the "application.xml" file like below in that case:
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.4">
    <description>Test EAR Example</description>
    <display-name>TestEAR Example</display-name>
    <module>
    <web>
    <font color=red> <web-uri>test</web-uri> </font><br>
    <context-root>test</context-root>
    </web>
    </module>
    </application>
    For more information on an EAR application structure you can refer to : http://middlewaremagic.com/weblogic/?p=1952
    Thanks
    Jay SenSharma
    http://middlewaremagic.com/weblogic (Middleware Magic Is Here)

  • How to access a jar file in EAR file?

    I have a EAR file which contains EJB.jar file and util.jar file. Outside of EAR, I mean in client side, I need to reference util.jar file. How can I access it?
    EAR structure is
    |--+META-INF/
    |--|---application.xml
    |--|---manifest.mf
    |--EJB.jar
    |--|---+MEAT-INF/
    |--|---|--- deployment descriptors...
    |--|---|--- manifest.mf
    |--|--- EJB classes
    |--Util.jar
    Util.jar must be executed in server side. If I just add Util.jar in client program's classpath, when client program is executed, serverside Util.jar is executed? Or what else I should do in the client program to reference server-side Util.jar?

    Excellent question. I don't see any client-jar in your EAR file structure. So I am assuming you are writing a separate client application which will talk to the ejbs deployed as part of this EAR. You need to do the following:
    Write another EAR file with the following structure:
    ear:
    META-INF/application.xml
    util.jar
    client.jar
    client.jar should have a META-INF/MANIFEST.MF and that should contain Class-Path:util.jar and value for Main-Class attribute.
    Now deploy this new ear to your application server and execute it using Application Client Container that comes with your app server.
    If you don't want to write another EAR file, then bundle th client.jar in your original EAR file.
    Points to note are:
    you have to repackage util.jar again inside this ear file.
    For portability reason, you should use Class-Path manifest entry in client.jar. Refer to http://java.sun.com/j2ee/verified/packaging.html and J2EE platform spec section #8.2.
    Hope this helps,
    Sahoo

  • Porting *.war files and *.ear files to Weblogic 10.3

    If we can figure this issue out, I'll see if I can't publish/post a
    maven-based solution in the Maven and Oracle forums so that others
    will not have to go through our pain.
    We are having all the usual problems regarding where Weblogic expects
    to find things and what exclusions need to be made in weblogic.xml for
    war files and weblogic-application.xml for ear files. Any insights
    would be deeply appreciated.
    Here is what our exploded war structure currently looks like.
    |____index.jsp
    |____WEB-INF
    | |____lib
    | | |____...a long list of jar files
    | |____tags
    | | |____...a short list of tag files
    | |____applicationContext.xml
    | |____web.xml
    | |____content
    | | |____...a bunch of jsps
    | |____tlds
    | | |____...some tlds
    | |____classes
    | | |____mailProperties.properties
    | | |____struts.xml
    | | |____logback.xml
    | | |____com ... the root of our class heiarchy
    |____images
    | |____...a list of images
    |____META-INF
    | |____maven
    | | |____com
    | | | |____project-name
    | | | | |____pom.xml
    | | | | |____pom.properties
    | |____MANIFEST.MF
    |____script
    | |____...some java script files
    |____style
    | |____...some css files
    Exceptions when trying to deploy are as follows:
    INFO: ... initialized Struts-Spring integration successfully
    java.lang.Exception: Could not load
    servers/AdminServer/tmp//appmergegen_1254502686535_OurApp/war/WEB-INF/classes/com...
    at com.opensymphony.xwork2.util.finder.ClassFinder.readClassDef(ClassFinder.java:745)
    at com.opensymphony.xwork2.util.finder.ClassFinder.<init>(ClassFinder.java:148)
    The exception above repeats for every .class file found below
    WEB-INF/classes/com, i.e. the the ones in this module rather than the
    ones in included modules.
    Checking the file system shows that there is no such directory as
    "appmergegen_1254502686535_conap". I'm uncertain if there is actually
    supposed to be anything there, but it would seem like it.
    I've a theory that if we can solve the above issue, we can solve the
    rest ourselves.
    It would also be handy to know what packages may cause conflicts.

    Alright, my research points to the idea that this might have something to do with staging. Since this is a dev setup we don't have any managed servers or anything. All we have is AdminServer and that is it. We have only one domain and it is "base_domain". Does anyone know if this is wrong?

  • Running a J2EE application (ear file)

    I am new to J2EE. I have created a EnpDtls Servlet simply to greet a person by name - like sample application. But i am unable to see it in on web (localhost:8080). What should i give as url to view the application? I am using J2EE 1,4 Application Server 8.2 from SUN. and jsdk 1.5
    I can see my html file under Context Root i.e localhost:8080/EmpDtlsCx. But what should be the url to see the class file of my sevlet.
    Servlet is : EmpDtls.class
    ContextRoot : /EmpDtlsCx
    Web Display : EmpDtlsWebDsp
    EAR file : EmpDtlsEar
    I have used deploytool. I can also see the Application in Admin console (localhost:4848) -> Enterprise Application. But there also the Admin console does not give any otion of launch as it gives for Web Application. Please note that the verifier option in Admin consoile also passes of sucessfully.
    The deployment descriptors: application.xml, sun-application.xml are under <J2ee INSTALLDIR>/domains/domain1/applications/j2ee-apps/EmpDtlsEar/ - the name of the EAR file.
    Should i get ContextRoot as folder name ?
    Could anyone help in solving my problem ?
    The structure of directories and files is as follows
       EmpDtlsEar
       |
       |____ META-INF
       |                |
       |                |____ application.xml
       |                |____ sun-spplication.xml
       |                |____ sun-j2ee-ri.project
       |                |____ MANIFEST.MF
       |
       |____ war-ic.war
                       |
                       |____ EmpDtls.html
                       |
                       |____ META-INF
                       |                  |
                       |                  |__ MANIFEST.MF
                       |
                       |____ WEB-INF
                                         |
                                         |__ web.xml
                                         |
                                         |__ sun-web.xml
                                         |
                                         |__ sun-jee-ri.project
                                         |
                                         |__ classes
                                                  |
                                                  |__ EmpDtls.class
    thanks in advance
    tshot

    Ok, you have your servlet defined, but now you should map it using mapping tags. Try editing your web.xml file as follows (adding mapping):
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <display-name>EmpDtlsWarDisp</display-name>
      <servlet>
        <display-name>EmpDtlsWebDisp</display-name>
        <servlet-name>EmpDtlsWebComp</servlet-name>
        <servlet-class>tshot.EmpDtls</servlet-class>
      </servlet>
      <servlet-mapping>
        <servlet-name>EmpDtlsWebComp</servlet-name>
        <url-pattern>/EmpDtls</url-pattern>
      </servlet-mapping>
    </web-app>Note the adding of "tshot." in front of your EmpDtls in your servlet-class tag.
    This means you need to create a directory in your src location called "tshot", move your EmpDtls.java into the new directory, and then edit that java file, placing the following line at the top of it:
    package tshot;Once you have re-built and re-deployed this you should be able to access your servlet at:
    http://localhost:8080/EmpDtlsCx/EmpDtls
    Refactoring is a term used to mean you've decided to change the name of a variable, method or some alteration of your java file such as changing package names (or adding to a package in this case) whereby the results may or may not affect other classes which depend on this class. Typically, nowadays refactoring is usually done by selecting a refactoring command from a menu item or button within an IDE (Integrated Development Environment) whereby the IDE performs all of the dependancy checking for you and copies the change to affected areas where necessary. Thus, all you need to do is choose the right refactoring operation and click "Ok" in most cases. In the old days, you would have to keep track of all affected areas and manually edit where necessary, based on your imposed change.

  • Ear file  cant be deployed from  eclipse with jboss 3.2.7

    I am using eclipse with JBOSS IDE1.5
    I want to work with EJB in eclipse. I have created configured all neccessary directory structure , xml files and jar,war,ear files(using XDoclet Configureations).
    But i am not able to deploy my "ear" file . At that time i am getiing following message in JBOSS Console.
    16:48:41,937 INFO [EARDeployer] Init J2EE application: file:/F:/jboss-3.2.7/server/default/deploy/FiboApp.ear
    16:48:42,421 WARN [verifier] EJB spec violation:
    Bean : Fibo
    Section: 22.2
    Warning: The bean provider must specify the fully-qualified name of the enterprise bean's remote home interface, if any, in the <home> element.
    Info : Class not found on 'tutorial.interfaces.FiboHome': No ClassLoaders found for: tutorial.interfaces.FiboHome
    16:48:42,453 WARN [verifier] EJB spec violation:
    Bean : Fibo
    Section: 22.2
    Warning: The bean provider must specify the fully-qualified name of the enterprise bean's remote interface, if any, in the <remote> element.
    Info : Class not found on 'tutorial.interfaces.Fibo': No ClassLoaders found for: tutorial.interfaces.Fibo
    16:48:42,453 WARN [verifier] EJB spec violation:
    Bean : Fibo
    Section: 7.10.1
    Warning: The session bean must implement either a remote home and remote, or a local home and a local interface.
    Any suggestions or remarks will be greatly appreciated
    Thanks in advance
    satheesh

    Atlast it worked. The problem was that in my ejb-jar.xml I was referring to 2_0.dtd. I have changed that to 2.1 and it worked.
    Older ejb-jar.xml had:
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "C:/jboss-4.0.1sp1/docs/dtd/ejb-jar_2_0.dtd">
    I changed that to:
    <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" version="2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
    And it worked.
    -Sathish

  • (un)deploy a single component in an .ear File in WLS 6.1

    I deployed a .ear File, that contains 25 EJBs and 5 webapplications) in WLS
    6.1. Everything is fine. Now i tried to undeploy a single EJB that is
    contained in the .ear File. But when i mark this EJB in the WLS admin
    console as undeployed, all other EJBs and WARs are marked as undeployed.
    Is this becaue of the J2EE specification or is it a weblogic feature /
    problem?
    alexander

    This issue is seen only with IBM JDK 1.6 (any SR) because, IBM packages the xerces version 2.9 as a part of $IBM_JDK_HOME/jre/lib/xml.jar.
    I think/understand that, your application is also packaging a xerces impl jar(different version otherthan xerces version 2.9) in WEB-INF/lib of you application.
    So, to make sure that the WebLogic Server uses the xerces impl jar that has been packaged, you are trying to use the filtered classloader in weblogic-application.xml
    But the filtered classloader would not have any effect, since, the IBM JDK packaged xerces parsers would also be with the same package structure. So, I think you should try with setting the following in WEB-INF/weblogic.xml inside the <weblogic-web-app> tag.
    <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
    I think this should work with WLS 11gR1PS2 (WLS 10.3.3).

  • Command link not working for project on deployment as ear file

    Hi Jdev team / Jheadstart team,
    Its a very strange problem i am facing ..
    I have two screen with the same VO showing the details records split in two pages ( Master/ details)
    it shows a table structure in the firts screen and on clicking through the command link shows the details in the secong page .
    its working fine on the LOCAL machine ( JDEV) but once the ear file is deployed to the server it gives the follwing exception :
    07/08/08 09:01:23 [1681] *** Using bean introspection to lookup value :currentRowIndexInRange
    07/08/08 09:01:23 [1682] Key(String, AttributeDef[]): Invalid Key String found. AttributeCount:31599 does not match Key attributes
    07/08/08 09:01:23 [1683] DCBindingContainer.reportException :oracle.jbo.InvalidParamException
    07/08/08 09:01:23 [1684] oracle.jbo.InvalidParamException: JBO-25006: Invalid parameter value 7B6F7E6F7BF9747D for String passed to method Constructor:Key. Explanation: {3}     
    at oracle.jbo.Key.parseBytes(Key.java:489)
         at oracle.jbo.Key.<init>(Key.java:183)
         at oracle.adf.model.bc4j.DCJboDataControl.setCurrentRowWithKey(DCJboDataControl.java:863)
    Secondly when i use the button instead of the command link it works fine on the machine and deployed on server.
    Please tell me is it some thing to take care in the bindings files when regenerating through Jheadstart
    (I am using JHeadstart, Jdev 10.1.3) and regenerating using AMApplication Generator file.
    the bindings its generating in both cases (command links / button )are :
    <action id="setCurrentRowWithKeySmeFundingAdviser"
    IterBinding="SmeFundingAdviserIterator"
    InstanceName="SmeFundingAdviserFirmsAMDataControl.XXSmeFundingAdviserVO1"
    DataControl="SmeFundingAdviserFirmsAMDataControl"
    RequiresUpdateModel="false" Action="96">
    <NamedData NDName="rowKeyStr" NDValue="#{row.rowKeyStr}" NDType="java.lang.String"/>
    Please its very urgent .....
    regards
    Jazz

    Use the uninstall scripts from Adobe to completely remove all vestiges of PPro from your computer. Then perform the installation.
    Links to the scripts are on the troubleshooting page.
    Cheers
    Eddie

  • Static files within a ear file     - help me if you can I am feeling down

    I am using oc4j.
    I have some static files (templates and configuration files for the applications) in an ear file.
    These files are addressed via web.xml init param and I use relative path.
    This works in my "working directory".
    But when I deploy the ear file the servlet cannot access the file (io exception file test/templates/temp.txt not found).
    Has anybody an idea how I must address the files in the web.xml?
    How can I address the files from /test level?
    Or is somthing wrong with the structur of the directory?
    my "working dirctory"
    appname/
    META-INF/application.xml
    test/
    web-inf/web.xml
    /classes
    /lib
    templates/temp.txt
    init-param
    <param-value>appname/test/templates/temp.txt</param-value>
    init-param
    <param-value>/test/templates/temp.txt</param-value>
    thanks in advance
    peter

    If these files are only accessed from the web module, then put these files in a subdirectory of the "WEB-INF" directory of the war file.

  • ClassNotFoundException trying to load classes in a .war file inside an .ear file

    Hi. I've deployed an EJB2 enterprise app as an ear file on WebLogic 6
              without errors. The ear file contains web app and ejb components in war and
              jar files. The web component is set to be the default web app in the
              config.xml file. Everything deploys without error messages.
              My problem is that I get ClassNotFoundExceptions when I try to invoke a
              servlet (via its servlet-mapping) or do Class.forName() on any class file in
              the war file.
              I see in '.wl_temp_do_not_delete' that the ear file has been decomposed into
              the ejb jar and web war files. The war file is not 'exploded' into a
              directory structure, however (as the console.war is). Is this an error
              (should the class packages in the war file be 'exploded'?)
              I don't see a tag in the web.xml, config.xml, or application.xml that tells
              the server to explode the war file--is there one?
              Note that if I manually copy the exploded class folders into the
              '_tmp_war_myserver_myserver_<<webappname>>' directory (and not, curiously,
              into a WEB-INF/classes subdirectory of that directory), the servlets and
              other classes load correctly. Also, jsps and html files load just fine
              without exploding the war file.
              Note also that the server complains about not being able to find the
              classes, even though it reports that the decomposed war file is in the
              classpath. Is there a problem loading class files from a .war file (because
              the namespace is different, with root classes located in WEB-INF/classes
              rather than the .war file's root?)
              Also, in the application.xml file, what is the meaning of the
              <context-root></context-root> element? What should its value be? What if
              you leave it blank?
              Thanks for any help,
              Reid
              

    Is there a way to add jar libraries to the Oracle JVM CLASSPATH? Is this the same as the system's CLASSPATH env. variable?
    Thank you!
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Alex McClennan ([email protected]):
    The package prefix in the code extract was correct - i.e. "oracle.aurora.jndi". A value of "oracle.aurora.jndi.*" would be incorrect.
    The problem is that the context factory implementation specified (com.evermind.server.ApplicationClientInitialContextFactory
    ) can't be found, the mostly likely reason being that the library containing the class isn't on the classpath.
    Cheers,
    ax<HR></BLOCKQUOTE>
    null

  • How to deploy EAR file in Tomcat?

    Is we can deploy ear file in tomcat?
    Normally we can deploy WAR file in tomcat webapps folder. When we run the tomat it will automatically extract the war file.
    But samethink I have tried EAR file. But it is not working.
    Is we can deploy EAR file or not?
    If not plz give reason.

    Hi
    Normally we can deploy the war file thats routene stuff ofcourse ..........but when u deploy ear file it will give problmes as ear structure and war structure are differeant
    The Tomcat Servlet/JSP Container      
    The Apache Tomcat 5.5 Servlet/JSP Container
         Apache Logo
    Links
    * Docs Home
    Contents
    * Contents
    * Introduction
    * Installation
    * Deployment
    * Source Code
    * Processes
    * Example App
    Application Developer's Guide
    Deployment
         Printer Friendly Version
    print-friendly
    version
    Background
    Before describing how to organize your source code directories, it is useful to examine the runtime organization of a web application. Prior to the Servlet API Specification, version 2.2, there was little consistency between server platforms. However, servers that conform to the 2.2 (or later) specification are required to accept a Web Application Archive in a standard format, which is discussed further below.
    A web application is defined as a hierarchy of directories and files in a standard layout. Such a hierarchy can be accessed in its "unpacked" form, where each directory and file exists in the filesystem separately, or in a "packed" form known as a Web ARchive, or WAR file. The former format is more useful during development, while the latter is used when you distribute your application to be installed.
    The top-level directory of your web application hierarchy is also the document root of your application. Here, you will place the HTML files and JSP pages that comprise your application's user interface. When the system administrator deploys your application into a particular server, he or she assigns a context path to your application (a later section of this manual describes deployment on Tomcat). Thus, if the system administrator assigns your application to the context path /catalog, then a request URI referring to /catalog/index.html will retrieve the index.html file from your document root.
    Standard Directory Layout
    To facilitate creation of a Web Application Archive file in the required format, it is convenient to arrange the "executable" files of your web application (that is, the files that Tomcat actually uses when executing your app) in the same organization as required by the WAR format itself. To do this, you will end up with the following contents in your application's "document root" directory:
    * *.html, *.jsp, etc. - The HTML and JSP pages, along with other files that must be visible to the client browser (such as JavaScript, stylesheet files, and images) for your application. In larger applications you may choose to divide these files into a subdirectory hierarchy, but for smaller apps, it is generally much simpler to maintain only a single directory for these files.
    * /WEB-INF/web.xml - The Web Application Deployment Descriptor for your application. This is an XML file describing the servlets and other components that make up your application, along with any initialization parameters and container-managed security constraints that you want the server to enforce for you. This file is discussed in more detail in the following subsection.
    * /WEB-INF/classes/ - This directory contains any Java class files (and associated resources) required for your application, including both servlet and non-servlet classes, that are not combined into JAR files. If your classes are organized into Java packages, you must reflect this in the directory hierarchy under /WEB-INF/classes/. For example, a Java class named com.mycompany.mypackage.MyServlet would need to be stored in a file named /WEB-INF/classes/com/mycompany/mypackage/MyServlet.class.
    * /WEB-INF/lib/ - This directory contains JAR files that contain Java class files (and associated resources) required for your application, such as third party class libraries or JDBC drivers.
    When you install an application into Tomcat (or any other 2.2/2.3-compatible server), the classes in the WEB-INF/classes/ directory, as well as all classes in JAR files found in the WEB-INF/lib/ directory, are made visible to other classes within your particular web application. Thus, if you include all of the required library classes in one of these places (be sure to check licenses for redistribution rights for any third party libraries you utilize), you will simplify the installation of your web application -- no adjustment to the system class path (or installation of global library files in your server) will be necessary.
    Much of this information was extracted from Chapter 9 of the Servlet API Specification, version 2.3, which you should consult for more details.
    Shared Library Files
    Like most servlet containers, Tomcat 5 also supports mechanisms to install library JAR files (or unpacked classes) once, and make them visible to all installed web applications (without having to be included inside the web application itself. The details of how Tomcat locates and shares such classes are described in the Class Loader HOW-TO documentation. For the purposes of our discussion, there are two locations that are commonly used within a Tomcat 5 installation for shared code:
    * $CATALINA_HOME/common/lib - JAR files placed here are visible both to web applications and internal Tomcat code. This is a good place to put JDBC drivers that are required for both your application and internal Tomcat use (such as for a JDBCRealm).
    * $CATALINA_BASE/shared/lib - JAR files placed here are visible to all web applications, but not to internal Tomcat code. This is the right place for shared libraries that are specific to your application.
    Out of the box, a standard Tomcat 5 installation includes a variety of pre-installed shared library files, including:
    * The Servlet 2.4 and JSP 2.0 APIs that are fundamental to writing servlets and JavaServer Pages.
    * An XML Parser compliant with the JAXP (version 1.2) APIs, so your application can perform DOM-based or SAX-based processing of XML documents.
    Web Application Deployment Descriptor
    The description below uses the variable name $CATALINA_HOME to refer to the directory into which you have installed Tomcat 5, and is the base directory against which most relative paths are resolved. However, if you have configured Tomcat 5 for multiple instances by setting a CATALINA_BASE directory, you should use $CATALINA_BASE instead of $CATALINA_HOME for each of these references.
    As mentioned above, the /WEB-INF/web.xml file contains the Web Application Deployment Descriptor for your application. As the filename extension implies, this file is an XML document, and defines everything about your application that a server needs to know (except the context path, which is assigned by the system administrator when the application is deployed).
    The complete syntax and semantics for the deployment descriptor is defined in Chapter 13 of the Servlet API Specification, version 2.3. Over time, it is expected that development tools will be provided that create and edit the deployment descriptor for you. In the meantime, to provide a starting point, a basic web.xml file is provided. This file includes comments that describe the purpose of each included element.
    NOTE - The Servlet Specification includes a Document Type Descriptor (DTD) for the web application deployment descriptor, and Tomcat 5 enforces the rules defined here when processing your application's /WEB-INF/web.xml file. In particular, you must enter your descriptor elements (such as <filter>, <servlet>, and <servlet-mapping> in the order defined by the DTD (see Section 13.3).
    Tomcat Context Descriptor
    The description below uses the variable name $CATALINA_HOME to refer to the directory into which you have installed Tomcat 5, and is the base directory against which most relative paths are resolved. However, if you have configured Tomcat 5 for multiple instances by setting a CATALINA_BASE directory, you should use $CATALINA_BASE instead of $CATALINA_HOME for each of these references.
    A /META-INF/context.xml file can be used to define Tomcat specific configuration options, such as loggers, data sources, session manager configuration and more. This XML file must contain one Context element, which will be considered as if it was the child of the Host element corresponding to the Host to which the The Tomcat configuration documentation contains information on the Context element.
    Deployment With Tomcat 5
    In order to be executed, a web application must be deployed on a servlet container. This is true even during development. We will describe using Tomcat 5 to provide the execution environment. A web application can be deployed in Tomcat by one of the following approaches:
    * Copy unpacked directory hierarchy into a subdirectory in directory $CATALINA_HOME/webapps/. Tomcat will assign a context path to your application based on the subdirectory name you choose. We will use this technique in the build.xml file that we construct, because it is the quickest and easiest approach during development. Be sure to restart Tomcat after installing or updating your application.
    * Copy the web application archive file into directory $CATALINA_HOME/webapps/. When Tomcat is started, it will automatically expand the web application archive file into its unpacked form, and execute the application that way. This approach would typically be used to install an additional application, provided by a third party vendor or by your internal development staff, into an existing Tomcat installation. NOTE - If you use this approach, and wish to update your application later, you must both replace the web application archive file AND delete the expanded directory that Tomcat created, and then restart Tomcat, in order to reflect your changes.
    * Use the Tomcat 5 "Manager" web application to deploy and undeploy web applications. Tomcat 5 includes a web application, deployed by default on context path /manager, that allows you to deploy and undeploy applications on a running Tomcat server without restarting it. See the administrator documentation (TODO: hyperlink) for more information on using the Manager web application.
    * Use "Manager" Ant Tasks In Your Build Script. Tomcat 5 includes a set of custom task definitions for the Ant build tool that allow you to automate the execution of commands to the "Manager" web application. These tasks are used in the Tomcat deployer.
    * Use the Tomcat Deployer. Tomcat 5 includes a packaged tool bundling the Ant tasks, and can be used to automatically precompile JSPs which are part of the web application before deployment to the server.
    Deploying your app on other servlet containers will be specific to each container, but all containers compatible with the Servlet API Specification (version 2.2 or later) are required to accept a web application archive file. Note that other containers are NOT required to accept an unpacked directory structure (as Tomcat does), or to provide mechanisms for shared library files, but these features are commonly available.
    Copyright © 1999-2006, Apache Software Foundation

  • Help to solve problem with packaging log4j in a EAR file

    Hi All
    i struggle hard to create a EAR composed of EJB JARs and WARs and the programs
    in these JARs and WARs use log4j to log msg. Because i want all J2EE apps to have
    their own version of log4j library, i package log4j.jar in the EAR file. Below
    is my EAR package structure
    EJB1.jar
    EJB2.jar
    SharedUtilities.jar
    log4j.jar
    log4j.properties
    WEBAPP1.war
    WEBAPP2.war
    META-INF/manifest.mf
    For both EJB1.jar and EJB2.jar's META-INF/manifest.mf, there is a below entries
    Manifest-Version: 1.0
    Class-Path: SharedUtilities.jar log4j.jar
    However, my program always hit below runtime error.
    [java] Caused by: javax.ejb.TransactionRolledbackLocalException: EJB Exception:
    : java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
    But the program in EJB1.jar and EJB2.jar seem to have no such problem in loading
    classes in SharedUtilities.jar. The problem can be eliminated if i put log4j.jar
    at system classpath. Can anybody provide me with info on how to package a log4j
    library within a EAR package ?
    In addition, where should i put the log4j.properties so that it will be at search
    path of log4j and automatically loaded by log4j lib
    regards
    Danny

    Hi Slava Imeshev
    I am a bit confused about your reply. As said, the log4j.jar was packaged in my
    ear file. If the log4j.jar was not packaged in ear file, how come the ejb classloader
    can locate it.
    Secondly, if log4j.jar is included in system classpath, the ejb also can load
    log4j classes by system classloader. No "NoClassDeffound" exception is thrown.
    regards
    dso
    "Slava Imeshev" <[email protected]> wrote:
    "dso" <[email protected]> wrote in message
    news:[email protected]...
    Hi Slava Imeshev
    thanks for your response. I am a bit confused about your answer.
    i can't understand why u said the classloader COULD loadorg/apache/log4j/PropertyConfigurator.
    According to the error msg, it said
    " java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator".
    Seemingly,
    this class in log4j.jar could not be located. But as i said in lastquestion,
    i seemed to have properly
    edit the "META-INF/manifest.mf" in EJB1.jar and EJB2.jar to includelog4j.jar
    in "Class-path" attribute. And my EJB classes have no problem in loadingclasses
    in SharedUtilities.jar. Would u please elaborate on it in more details?
    Sure. NoClassDefFoundError means that a DEPENDING class
    can not be loaded. If the classloader were not able to load the class
    itself, it would give you ClassNotFoundException.
    Just make sure that you don't have the same packages in
    the ear and in the class path so that you don't have classes
    loaded by system classloader trying to load classes loaded
    by ejb classloaders.
    regards
    dso
    "Slava Imeshev" <[email protected]> wrote:
    First, this error means that classloader was able to load
    org/apache/log4j/PropertyConfigurator, but cold not load
    one of depending classes. I'd inspect the CLASSPATH
    to see if there are any log4 classes there.
    Second, you can package your log4.properties into
    log4.jar itself.
    Regards,
    Slava Imeshev
    "dso" <[email protected]> wrote in message
    news:[email protected]...
    Hi All
    i struggle hard to create a EAR composed of EJB JARs and WARs and
    the
    programs
    in these JARs and WARs use log4j to log msg. Because i want all
    J2EE
    apps
    to have
    their own version of log4j library, i package log4j.jar in the EARfile.
    Below
    is my EAR package structure
    EJB1.jar
    EJB2.jar
    SharedUtilities.jar
    log4j.jar
    log4j.properties
    WEBAPP1.war
    WEBAPP2.war
    META-INF/manifest.mf
    For both EJB1.jar and EJB2.jar's META-INF/manifest.mf, there is
    a below
    entries
    Manifest-Version: 1.0
    Class-Path: SharedUtilities.jar log4j.jar
    However, my program always hit below runtime error.
    [java] Caused by: javax.ejb.TransactionRolledbackLocalException:EJB
    Exception:
    : java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
    But the program in EJB1.jar and EJB2.jar seem to have no such problemin
    loading
    classes in SharedUtilities.jar. The problem can be eliminated if
    i
    put
    log4j.jar
    at system classpath. Can anybody provide me with info on how to
    package
    a
    log4j
    library within a EAR package ?
    In addition, where should i put the log4j.properties so that it
    will
    be at
    search
    path of log4j and automatically loaded by log4j lib
    regards
    Danny

Maybe you are looking for

  • Slow, not responding, and not compatible with java etc since updating to 6.0.2. Love Firefox normally but am not happy.

    Since updating to Firefox 6.0.2 i have not been happy with the way it is running. It is incredibly slow, keeps telling me its 'not responding' and looking at my add-ons, seems incompatible with the java console, with skype click to call, etc. I also

  • BP replication from CRM 7.0 to ERP 6.0

    Hello. I was made customizing replication BUPA_MAIN object from CRM 7.0 to ERP as of Best Practics. When i creating a BP in CRM it's replicating in ERP as Customer only, not as BP. What I need to customize that BP is created during replicating from C

  • Business Explorer Error after installation of SAP GUI 7.10

    Hi Experts we have installed  SAP GUI 7.10 successfully and there seems to be an error on Business Explorer.. while processing some of the queries in designer it gives out an error message " critical program error occured.The program has to close.Ple

  • MRP Issue in MD51

    Hi All, Facing problem in MRP run...pls see the scenario Case -1 Sales Order - A Line item - 10 Material - XXX Qty - 100 WBS - YYY If MRP runs for WBS-YYY in MD51 system creates Planned order/Prod ord for 100 Case -2 All parameters are same as that o

  • Raising exceptions on hanging or failing updates

    I have inherited a storeprocedure of around 400 lines of code wgich contains multiple SQL blocks of a update selection wrapped round a select statement. This store procedure works on dbA but not on dbB on dbA. it just hangs. dbA has more data, so it