Where to place /META-INF/context.xml ?

Hi,
Apologies, but this is a newbie question. In the tomcat docs, it states that
"A /META-INF/context.xml file can be used to define Tomcat specific configuration..."
Could you please tell me where /META-INF/context.xml is placed relative to web application root? In other words, if I have a web application in a directory /MyWebApp, should the /META-INF dir be in /MyWebApp/META-INF or should it be under /WEB-INF?
Thanks.
Ben

You seem to think that you can have only one META-INF directory; this is simply not true. Keep both your META-INF directories and put the files where they are expected. Yay for using overlapping names :/

Similar Messages

  • META-INF/context.xml, Tomcat, META-INF/services

    I presently have a Netbeans project laid out like this:
    src
    src\java
    web
    web\META-INF
    web\META-INF\context.xml
    etc. Tomcat finds that META-INF/context.xml OK and does what I expect with it.
    I have recently added something that is loaded by java.util.ServiceLoader, which requires a META-INF/services/x.y.z file containing the name(s) of the classes that implement x.y.z. After deployment, my webapp's ServiceLoader doesn't find it, because in the target it isn't in WEB-INF/classes/META-INF/services/x.y.z. If I put it into src/java/META-INF/services/x.y.z it works correctly, as it then ends up in the right place. However I'm now concerned that either Tomcat won't find the context.xml if I put it in the same place under src, because it would then not be in /META-INF/context.xml but rather /WEB-INF/classes/META-INF/context.xml, which in turn would mean that I would then need two META-INF directories. I'm about to test that conjecture about Tomcat finding it under WEB-INF/classes/META-INF, but I'm wondering whether I'm doing something basically wrong in the first place here.

    You seem to think that you can have only one META-INF directory; this is simply not true. Keep both your META-INF directories and put the files where they are expected. Yay for using overlapping names :/

  • Unable to find/read file META-INF/ra.xml

    When using the oc4j_admin_client to deploy an ear to a oas cluster I get this error, but only sometimes. I cannot find anything on the web that explains what might be causing this to occur. I'm guessing it might be with the configuration of OAS but even so I have no idea where to look. If anyone out there can give some advice it would help. Thanks,
    [Summary] There are total 1 instances in the operation.
    [Summary] Operation failed on applicationServerName/instanceName
    [Summary] Operation on cluster FAILED since 1 instanced failed!
    FINE: CoreRemoteMBeanServer.release call release on CoreRemoteMBeanServer: oracle.oc4j.admin.management.mejb.MEjb@5c1ae90c
    FINE: CoreRemoteMBeanServer.release Call remove on MBeanServer EJB
    FINE: CoreRemoteMBeanServer.release Call close on RMI Context: javax.naming.InitialContext@1629ce8c
    SEVERE: J2EEDeploymentManager.deploy Deploy error: Operation failed with error:
    Unable to find/read file META-INF/ra.xml in D:\oracle\u01\oas\10.1.3\j2ee\instanceName\connectors\AppName\AppName archive (IO Error: D:\oracle\u01\oas\10.1.3\j2ee\instanceName\connectors\AppName\AppName (The system cannot find the pat
    h specified))
    oracle.oc4j.admin.deploy.api.J2EEDeploymentException: Operation failed with error:

    Hi forum-hog,
    I think this is due to a known product defect. The patch is available and can be downloaded and installed.
    Please try the following:
    1) Download and apply patch 9073284
    2) Perform the deployment again
    Hope this helps.
    Thanks,
    Cris

  • ERROR ITMS-9000: "META-INF/container.xml must contain one and only one root file reference."

    Hi all,
    After correcting a table-of-contents error in my .epub file, I am unable to upload it via iTunes Producer. It lists this error message:
    ERROR ITMS-9000: "META-INF/container.xml in 9780615431727.epub must contain one and only one root file reference." at Book (MZItmspBookPackage)
    The file has been verified and only has one root file reference in the container.xml file.
    Has anyone been able to find a solution to this problem?
    Thanks!

    Hello Forum Users…
    For those of you who have run into the upload roadblock, getting an error message similar to this:
    Package Summary:
    1 package(s) were not uploaded because they had problems:
              /Users/slm/Desktop/MUSIC to PICTURE for IBOOK/2012 MTP for iTUNES Bookstore/9780615600918.itmsp - Error Messages:
                        Apple's web service operation was not successful
                        Unable to authenticate the package: 9780615600918.itmsp
                        ERROR ITMS-9000: "OPS/ibooks.ncx(5): 'p50': fragment identifier is not defined in 'OPS/content9.xhtml'" at Book (MZItmspBookPackage)
    Following is a "specific" fix, but the idea of the fix will help you with your specifics too.
    I tried for 17 days to upload a book that looked and worked perfectly in iPAD via Preview.
    After many discussions with Apple, who to their credit stayed with me over 2-3 days, I decided to play a hunch.
    I went into a duplicated copy of the book and on every page, (because the error message was not telling the whole story), looked for what InDesign would call "Overset Text."
    Now... the "flaw" in iBOOK Author (hint) is that it won't advise you of this "overset text" as does InDesign.
    And to compound the matter, the exported ePUB document WORKS in iPAD Preview.
    See Screenshots from InDesign:
      Okay... Couldn't add it but it is a Warning Box that says there is overset text. (Characters which exceed the text box.)
    Nevertheless, I played this hunch, and sure enough found a few boxes with the + in them.  In other words I clicked on EVERY text holder and every text block in the entire document.
    Where I found + signs, I simply deleted some carriage returns from the iBOOK file... (please note… carriage returns and literally empty spaces that caused the overset text) and then erased all previous copies of the Music to Picture Book on my hard drive,  iTUNES and iPAD.
    The result?  A "text-book" upload with no snags!  As my Son would say… "Victory!"
    So, first make sure that you are using only PNGs, Jpegs and Movie files to iBook Specs.  Then... make sure there are no overset text boxes, which you must do manually.
    Enjoy & Godspeed!
    Steve
    Stephen Melillo, Composer
    STORMWORKS®
    209 Spinnaker Run
    Smithfield, VA 23430-5623
    USA
    v/f 757-356-1928
    stormworld.com
    “History is a vast early warning system.” Norman Cousins, editor and author (1915-1990)
    "This will be our reply to violence: to make music more intensely, more beautifully, more devotedly than ever before." Leonard Bernstein
    “If you have a chance to help someone, and you don’t, you are wasting your time on this earth.”  Roberto Clemente

  • No META-INF/application.xml was found in the EAR

    I create a EAR using:
    jar -cvf e:\workspace\otnapp\otnapp.ear
    Then, I depoy this EAR through:
    e:\jdk160_18\bin>java weblogic.Deployer -adminurl t3:\\localhost:7001 -user weblogic -passwork welcome1 -deploy -upload e:\workspace\otnapp\otnapp.ear
    But, I get errors as follow:
    java.io.IOException: No META-INF/application.xml was found in the EAR otnapp.ear
    How to change the jar in the command line?

    otnapp is an adf web application. META-INF is not in the E:\soaworkspace\otnapp.
    It is in the :
    E:\SOAworkspace\otnapp\.adf\META-INF
    E:\SOAworkspace\otnapp\Model\classes\META-INF
    E:\SOAworkspace\otnapp\src\META-INF
    None of them contains application.xml.
    I run jar in E:\soaworkspace\otnapp. But I get error : 'jar' is not recognized as an internal or external command, operable program or batch file.
    Microsoft Windows [Version 6.0.6001]
    Copyright (c) 2006 Microsoft Corporation. All rights reserved.
    C:\Users\Administrator>d:
    D:\>e:
    E:\>cd E:\soaworkspace\otnapp
    E:\SOAworkspace\otnapp>jar -cvf otnapp.ear
    'jar' is not recognized as an internal or external command, operable program or batch file.
    E:\SOAworkspace\otnapp>jar -cvf otnapp.ear */ .
    'jar' is not recognized as an internal or external command, operable program or batch file.
    E:\SOAworkspace\otnapp>set java_home
    JAVA_HOME=E:\OracleBI_win2008_32_20101206\jdk160_18
    path=
    CD:\apache-maven-2.0.11\bin;C:\app\Administrator\product\11.2.0\dbhome_1\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;C:\apps\FME\;C:\Program Files\Subversion\bin;C:\Program Files\TortoiseSVN\bin;D:\win2008EclipseWorkspace;E:\OracleBI_win2008_32_20101206\Oracle_BI1\bin;E:\OracleBI_win2008_32_20101206\Oracle_BI1\opmn\bin;E:\OracleBI_win2008_32_20101206\Oracle_BI1\opmn\lib;E:\OracleBI_win2008_32_20101206\Oracle_BI1\perl\bin;%JAVA_HOME%\bin;CATALINA_HOME\bin;C:\Users\Administrator>E:\SOAworkspace\otnapp>

  • Failed to load META-INF/application.xml when upgrading to wls9.2

    We are migrating our weblogic server from 8.1 to 9.2. Tried to use DDConverter to convert the EJB deployment descriptor, but when I ran weblogic.appc, I got the following error :
    <i><Error> <J2EE> <BEA-160197> <Unable to load descriptor D:\workspace\webshopEJB\wl9.2/META-INF/application.xml of module webshopLogic. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed</i>
    and
    <i>Caused by: com.bea.xml.XmlException: failed to load java type corresponding to e=application@http://java.sun.com/xml/ns/j2ee</i>
    Here is my application.xml
    <b><?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>webshop EJB module</description>
    <display-name>webshop Logic EJB</display-name>
    <module>
    <ejb>webshopLogic</ejb>
    </module>
    </application></b>
    I checked for classpath, and still no clue about what's going wrong. Thanks in advance for any help.

    I believe this likely is a classpath problem. I'd start by using the setWLSEnv.cmd or .sh script in the kit. That should set the classpath correctly.
    Also, FWIW it wasn't required to run DDConverter. You could have used your 8.1 descriptors unchanged in 9.x as well.
    -- Rob
    WLS Blog http://dev2dev.bea.com/blog/rwoollen/

  • Beginner Q: Which context.xml to place the DataSource setup?

    I am following this tutorial to use DataSource to access the database. http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
    I originally place the Resource specificaiton in TOMCAT_HOME/conf/context.xml. My demo app works fine. I then experiment to move that section to My_App/Meta-inf/context.xml. Later, I need to uninstall and re-install Java and Tomcat. Then I run into to the problem in my demo http://forum.java.sun.com/thread.jspa?threadID=5299262
    I finally restore the resource section in TOMCAT_HOME/conf/context.xml to make my demo working again. From this explaination of Context (http://tomcat.apache.org/tomcat-6.0-doc/config/context.html), my understanding is that placing the resource in My_App/Meta-inf/context.xml should be better for deployment purpose. I am not understanding the need to placing resource in conf/context.xml.
    Is there any tutorial that will explain this context concept? I would like to see different setup in the path and docbase.

    eventhough it's working fine. I may have deployment problem. Anyway thanks for the reply.
    Regards,
    Ram

  • Context.xml question , Thanks

    Hi, developers:
    I would like to connect to another server using context.xml. I did like the following link: < a href="http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html"> link to instruction</a>
    In the "JDBC Data Source" :4 Configure Tomcat's Resource Factory part said a Context.xml tshould be stored in the META-INF directory .
    My problem is:
    1) where is /META-INF so I can find the contect.xml. I using tomcat5.5 and find only at Tomcat5.5\conf\context.xml?
    2) When I restart with my context.xml below, the tomcat can start but application can NOT.
    Error msd: Http status 404 : The requested resource (/account App) is not available.
    code of context.xml is:
    <?xml version='1.0' encoding='utf-8'?>
    <Context displayName="account" path="/accountApp" debug="0" reloadable="true" docBase="serverdb">
    <Resource name="jdbc/dbinstance" auth="Container" type="javax.sql.DataSource"
    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
    driverClassName="oracle.jdbc.OracleDriver"
    url="jdbc:oracle:thin:@//dburl:1522/"
    username="accuser"
    password="accpw"
    maxActive="20"
    maxIdle="10"
    maxWait="120000"
    removeAbandoned="true"
    logAbandoned="true"
    removeAbandonedTimeout="300"
    testOnBorrow="true"
    testOnReturn="true"
    validationQuery="select 1 from dual" />
    </Context>
    is some one can give me a help to solve it. Thanks in advance

    The "context" here is an artifact of the way that Tomcat works. It contains deployment information - the path to the application files, the JNDI mappings and various other bits and pieces.
    The "context" of a web application is the path to which it is deployed within the application server. An application deployed to a context called "foo" would probably be accessed by the following URL:
    http://localhost:8080/foo/And the application files would probably be stored somewhere like this:
    C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\fooTomcat keeps its context information EITHER in a file called server.xml or in a seperate file named after the application's context. So typically it will be in one of these files (for our "foo" application):
    C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\server.xml
    C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\Catalina\localhost\foo.xmlYou can create the entry in one of several ways:
    1. Edit server.xml manually
    2. Edit foo.xml manually
    3. Use an application such as the admin webapp to deploy your application
    4. Include a Context.xml file in the META-INF directory of the application
    The last option allows you to specify the default values that you want the application to take up when you deploy it to Tomcat. This saves time during development, but may cause problems for your clients when they come to deploy the application themselves.
    It is this last file that you seem to be talking about. You would normally create it as a directory and file within the source directory for your application, from which you build and deploy a WAR file. For example, you might build the following files and directories into foo.war:
    C:\dev\foo\index.jsp
    C:\dev\foo\WEB-INF\web.xml
    C:\dev\foo\META-INF\MANIFEST.MF
    C:\dev\foo\META-INF\Context.xml
    This would be built to a WAR file called foo.war that represents a Zip of the contents of the C:\dev\foo directory. Deploying this will cause Tomcat to notice Context.xml and extract its contents into the conf/Catalina/localhost directory as foo.xml

  • Data source needs to be specified in context.xml instead of web.xml - why?

    Hi,
    I'm using a Spring JndiObjectFactoryBean to create my JNDI data source in my code:
    <bean id="jndiDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
              <property name="jndiName" value="java:comp/env/jdbc/DS_OURDB_DB2" />
              <property name="lookupOnStartup" value="false"/>
              <property name="proxyInterface" value="javax.sql.DataSource"/>
         </bean>I have the necessary Resource added to my Tomcat's server.xml:
    <Resource accessToUnderlyingConnectionAllowed="false"
                defaultAutoCommit="true" defaultReadOnly="false"
                driverClassName="com.ibm.db2.jcc.DB2Driver"
                factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
                initialSize="0" logAbandoned="false" maxActive="8"
                maxIdle="8" maxOpenPreparedStatements="0" maxWait="-1"
                minEvictableIdleTimeMillis="1800000" minIdle="0"
                name="jdbc/DS_OURDB_DB2" numTestsPerEvictionRun="3"
                password="ourpass" poolPreparedStatements="false"
                removeAbandoned="false" removeAbandonedTimeout="300"
                testOnBorrow="true" testOnReturn="false"
                testWhileIdle="false" timeBetweenEvictionRunsMillis="-1"
                type="javax.sql.DataSource"
                url="jdbc:db2://machine1:60056/DBD1" username="ouruser"
                   validationQuery="SELECT current date FROM sysibm.sysdummy1"/>I then have the resource referenced in my web.xml:
    <resource-ref>
              <res-ref-name>jdbc/DS_OURDB_DB2</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
              <res-sharing-scope>Shareable</res-sharing-scope>
         </resource-ref>However, I'm getting JndiLookupFailureExceptions when I attempt to use this JNDI resource.
    I can resolve it by specifying the following in my META-INF/context.xml:
    <Context>
         <ResourceLink global="jdbc/DS_OURDB_DB2" name="jdbc/DS_OURDB_DB2" type="javax.sql.Datasource"/>
    </Context>I've read some of the JNDI/Tomcat documentation. However, I still do not understand why it doesn't work with the web.xml. Can anyone explain please? Thanks

    Can answer this myself after some more investigation. The reason I required the entry in the META-INF/context.xml was because I had specified the Resource as a Global Reference in the server.xml. By adding this Resource to my application's Context in the server.xml the configuration in the web.xml worked as expected.

  • Tomcat 5.5 context.xml, how to configure the Host element

    [Probably this question should be asked elsewhere, if so please advise]
    Dear all,
    I understand that Tomcat 5.5 prefers that your web application comes with a context.xml file under the META-INF folder.
    So I added a context.xml file under the META-INF folder of my web application,
    please have a look below.
    context.xml
    <Context path="" docBase="C://Program Files//Apache Software Foundation//Tomcat 5.5//webapps//test">
         <Resource
              name="jdbc/testDB"
              factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
              auth="Container"
              type="javax.sql.DataSource"
              maxActive="10"
              maxIdle="5"
              maxWait="10000"
              removeAbandoned="true"
              removeAbandonedTimeout="60"
              logAbandoned="true"
              username="username"
              password="password"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost:3306/test" />
    </Context> Ok, that is good so far, but how do I configure the Host element.
    I mean how do you link a specific Host to a specific Context?
    Before, the Context element was a sub element of the Host element,
    now it is completely separated.
    Host in server.xml
    <Host name="www.test.com" deployOnStartup="true" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
         <Valve
              className="org.apache.catalina.valves.FastCommonAccessLogValve"
              prefix="test_access_log."
              suffix=".txt"
              pattern="common"
              directory="C://Program Files//Apache Software Foundation//Tomcat 5.5//webapps//test//logs"/>
    </Host> I assume that if I modify the appBase of the Host element from webapps to webapps/test then it would work, but if I have several
    Contexts for the specific Host, how should I configure it then?
    Please help by giving examples!

    OK, I have changed the Host's appbase to webapps/mytestapplication.
    I want to deploy a test.war under the appbase:
    webapps/mytestapplication/test.war
    The name of the host is www.test.com
    Because the war file is not named ROOT.war (instead it is named test.war),
    the URL to the test application would be www.test.com/test.
    Now I have several relative anchor links in the test application
    Say for example the test application is deployed and accessed through www.test.com/test.
    Clicking on the aboutus link would change to URL to www.test.com/aboutus.html.
    Instead, for this to work, the URL must be www.test.com/test/aboutus.html.
    Obviously, the easiest solution is to add /test before each anchor link:
    But the there must a different solution.
    Adding a path to Context element did not work:
    <Context path="/test" ...>
    </Context>
    Question:
    1. what is the solution for the anchor scenario above, should I add /test before each link?
    2. Is my configuration (can be seen at the bottom) correct?
    Basically, I have removed the path and docBase attributes from the Context element.
    I have also set autoDeploy to false in the Host element.
    Here are a few paragraphs from the docs:
    autoDeploy attribute of Host element:
    "Finally, note that if you are defining contexts explicitly,
    you should probably turn off automatic application deployment.
    Otherwise, your context will be deployed twice each, and that may cause problems for your app."
    OK, so I set autoDeploy to false since I am defining contexts explicitly, (META-INF/context.xml)
    docBase attribute of Context element:
    The value of this field must not be set when the Context
    is configured using a META-INF/context.xml file as it will be inferred by the automatic deployment process.
    So, I remove the docBase attribute eventhough I am confused a bit.
    This is the part that confuses me:
    If autoDeploy is set to false since I am defining contexts explicitly,
    how can then anything be inferred by the automatic
    deployment process? (please answer!)
    There should not be any automatic deployment process when autoDeploy is set to false.
    path attribute of Context element:
    The value of this field must not be set except when statically defining a Context in server.xml,
    as it will be inferred from the filenames used for either the .xml context file or the docBase.
    Same as the Context element.
    Thanks!
    <Context>
         <Resource
              name="jdbc/testDB"
              factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
              auth="Container"
              type="javax.sql.DataSource"
              maxActive="10"
              maxIdle="5"
              maxWait="10000"
              removeAbandoned="true"
              removeAbandonedTimeout="60"
              logAbandoned="true"
              username="username"
              password="password"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost:3306/test" />
    </Context>
    <Host name="www.test.com" deployOnStartup="true" debug="0" appBase="webapps/mytestapplication" unpackWARs="true" autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">
         <Valve
              className="org.apache.catalina.valves.FastCommonAccessLogValve"
              prefix="test_access_log."
              suffix=".txt"
              pattern="common"
              directory="C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/mytestapplication/test/logs"/>
    </Host>

  • Persistence.xml under classes/META-INF makes other jar references to miss

    Hi,
    When I am adding persistence.xml to classes/META-INF folder where classes folder got other packages under it, classes in such packages are not getting reference to respective jar files in lib folder. So, deployment of the web project in OAS (Oracle application server) 10g fails mentioning NoClassDef found for classes from library jars referred. If I remove persistence.xml from here, the war file is getting deployed. Deployment fails even when the persistence.xml is available anywhere in classpath (like WEB-INF).
    What is the reason & how to correct it?Any alternative approach like manifest or use some settings in OAS?

    Hi,
    To be accessible to the EJB JAR, WAR, or EAR file, a class or a JAR file must be on the deployment classpath. You can achieve this in one of the following ways:
    Put the JAR file in the manifest classpath of the EJB JAR or WAR file. Do this by adding a classpath entry to the META-INF/MANIFEST.MF file in the JAR or WAR file. You may specify one or more directories or JAR files, separating them by spaces. The following example shows how the manifest file classpath entry adds the employee/emp-classes.jar file and the employee/classes directory to the classpath of the JAR file that contains the manifest file:
    Class-Path: employee/emp-classes.jar employee/classes
    Place the JAR file in the library directory of the EAR filethis will make this JAR file available on the application classpath and accessible by all of the modules deployed within the EAR file. By default, this would be the lib directory of the EAR file, although you may configure it to be any directory in the EAR file using the library-directory element in the application.xml deployment descriptor. The following example shows the application.xml file:
    <application ...>
    <library-directory>myDir/jars</library-directory>
    </application>
    Java EE allows for persistence support in a variety of packaging configurations. You can deploy your application to the following module types:
    EJB modules: you can package your entities in an EJB JAR. When defining a persistence unit in an EJB JAR, the persistence.xml file is not optionalyou must create and place it in the META-INF directory of the JAR alongside the deployment descriptor, if it exists.
    Web modules: you can use WAR file to package your entities. In this case, place the persistence.xml file in the WEB-INF/classes/META-INF directory. Since the WEB-INF/classes directory is automatically on the classpath of the WAR, specify the mapping file relative to that directory.
    Persistence archives: a persistence archive is a JAR that contains a persistence.xml file in its META-INF directory and the managed classes for the persistence unit defined by the persistence.xml file. Use a persistence archive if you want to allow multiple components in different Java EE modules to share or access a persistence unit. The following example shows how to package entities in a persistence archive:
    emp.ear
    emp-persitence.jar
    META-INF/persistence.xml
    META-INF/orm.xml
    examples/model/Employee.class
    examples/model/Phone.class
    examples/model/Address.class
    examples/model/Department.class
    examples/model/Project.class
    Once you created a persistence archive, you can place it in either the root or the application library directory of the EAR. Alternatively, you can place the persistence archive in the WEB-INF/lib directory of a WAR. This will make the persistence unit accessible only to the classes inside the WAR, but it enables the decoupling of the definition of the persistence unit from the web archive itself.
    Regards,
    Vinay

  • How to use ClassPath defined in META-INF/MANIFEST.MF in an EAR

    Hi,
    We have an EAR Shared Library (Name = AA) deployed in Weblogic. EAR contents are like ->
    APP-INF/lib/directoryA/<<50 JAR Files>>
    META-INF/MANIFEST.MF --->> Has Class Path to above JAR files, Spec Version, Impl Version etc
    META-INF/application.xml
    META-INF/weblogic.application.xml
    This EAR is deployed as Shared Library, and our EJB (name = BB) refers to this EAR. Now the problem we are facing is that the JARs are not reachable by EJB BB. If we restructure the Shared Library project so that all the JARS are under APP-INf/lib/ directory, we are able to access the JARS from EJB BB. (This means that we are referring the shared library correctly, using "library-ref" tag correctly.
    Is there a way we can specify EJB BB to look for CLASS PATH as present in the MANIFEST.MF file of the Shared Library ??
    Thanks,

    WebLogic specifies a separate classloader for the APP-INF/lib directory that is why it gets loaded
    When you have some.jar file placed in an arbitrary directory, for example, somewhere. You can either
    use application.xml, for example,
    <application ...>
        <module>
            <ejb>EJB.jar</ejb>
        </module>
        <module>
            <web>
                <web-uri>Web.war</web-uri>
                <context-root>MiddlewareMagic</context-root>
            </web>
        </module>
         <library-directory>somewhere</library-directory>
    </application> Or by using the manifest Class-Path entry option which requires adding a META-INF/MANIFEST.MF file with the following contents:
    Manifest-Version: 1.0
    Class-Path: somewhere/some.jarMore information on class loading and application packaging can be found here: http://middlewaremagic.com/weblogic/?p=6725

  • Contents of META-INF/services/javax.xml.parsers.DocumentBuilderFactory?

    I am currently working on an applet that solves Sudoku puzzles, allowing you to build your own in a Constructor and then solve them in a seperate Solver. To do this, we are implementing the puzzles files as XML documents.
    I have the code completely complied and on the server ( [sudoku.unl.edu|sudoku.unl.edu]) and it runs NEARLY perfectly, however when trying to access the server to save the xml code, the apache error_log presents this message: "File does not exist: classes/META-INF/services
    /javax.xml.parsers.DocumentBuilderFactory"
    Looking at the Java Doc here it says that the program should look for that in the jars. I am unsure of exactly how the applet is interacting with the server, but typing "java -version" yields:
    java version "1.6.0_11"
    Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
    Java HotSpot(TM) 64-Bit Server VM (build 11.0-b16, mixed mode)Notably, the code works PERFECTLY in NetBeans, contacting the server using SCP and uploading the file and such, so the code doesn't seem to be the problem, unless I need to direct the DocumentBuilder code somehow. This is the code that I believe is causing the trouble (I have tried to include all relevant imports that are in my code):
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    DocumentBuilderFactory factoryBuilder;
              DocumentBuilder builder;
              Document doc;
              Element docElement;
              try
                   factoryBuilder  = DocumentBuilderFactory.newInstance( );
                   builder = factoryBuilder.newDocumentBuilder();
                   doc = builder.parse( indexLocation );
                   docElement = doc.getDocumentElement();
                   NodeList children = docElement.getChildNodes();          
                   for(int i =0; i < children.getLength(); i++)
                        if(children.item(i).getNodeType() == 1)
                             if((children.item(i).getNodeName()).equals("directory"))
                                  if ((children.item(i).getAttributes().getNamedItem("name").getNodeValue()).equals("UsersInput")) {
                                       Node firstChild = findNodeItem(children.item(i), "Difficulty0.." + this.upperField.getText());
                                       Node secondChild = findNodeItem(firstChild, "Level" + this.levelField.getText());
                                       Node thirdChild = findNodeItem(secondChild, (String)suTypeList.getSelectedItem());
                                       Element newFile = doc.createElement("file");
                                       newFile.setAttribute("name", fileName);                              
                                       thirdChild.appendChild(newFile);                              
                   SshParameters params = new SshParameters("cse.unl.edu", "consystlab","A/tutti");
                // create new Scp instance
                Scp scp = new Scp(params);
                // register event listener
                scp.addListener(this);
                // establish connection
                scp.connect();
                   TransformerFactory tFactory = TransformerFactory.newInstance();
                   Transformer transformer = tFactory.newTransformer();
                   DOMSource source = new DOMSource(doc);
                   StringWriter sw=new StringWriter();
                   StreamResult result = new StreamResult(sw);
                   transformer.transform(source, result);
                   String xmlString=sw.toString();
                // upload file
                  scp.upload(xmlString.getBytes(), indexPath, "libraryIndex.xml");
                 // disconnect
                scp.disconnect();
              catch (IOException e)
                   System.out.println("IO ERROR7");
                   System.out.println(e);
              catch (TransformerException tranE){
                   tranE.printStackTrace();               
              catch (ParserConfigurationException e)
                   System.out.println("IO ERROR8");
                   System.out.println(e);
              catch (SAXException e)
                   System.out.println("IO ERROR9");
                   System.out.println(e);
              }So my question is, what exactly are the contents of the file in the META-INF/services folder? I have manually created this file in my classes directory, where the program is searching. When I place text in it, it appends the text with .class and searches for that file, but doesn't seem to do anything with the file. I attempted directing it to the "DocumentBuilderFactory.class" file that I extracted from the classes.jar included with the JDK.
    I feel like all I need is this file to contain the correct content and the code will FINALLY work, but I have not been able to find anything out there on it.
    Thank for you for your help, sorry this was such a long message.
    -Jason

    Thanks!
    Thanks for the fast reply. I don't know if I made my point clear.
    I do not want to determine the parser by myself. I want the client system use the default parser, so I do not have the hit of downloading the fairly large parser jar.
    However, I want it not to do an empty request to the server for nothing. This turn around time kills an Applet. I want a fast loading applet!
    I'll go in trial and error mode, when I find the time next week.
    Thanks again, I appreciate it!
    K<o>

  • Error while reading 'META-INF/weblogic-cmp-rdbms-jar.xml

    Hi,
    I am getting an error running appc. I am upgrading from wl 7 to wl 8.1. ejbc works
    fine on wl 7. Anyone seen this before?
    [J2EE:160121]Errors encountered while compiling module 'e:\dev\xstatic\tmp\xstatic_Intermediate.jar':
    [EJB:011017]Error while reading 'META-INF/weblogic-cmp-rdbms-jar.xml'. The error
    was:
    java.lang.NullPointerException
    at weblogic.ejb20.cmp.rdbms.finders.ExprWHERE.init_method()V(ExprWHERE.java:47)
    at weblogic.ejb20.cmp.rdbms.finders.BaseExpr.init(Lweblogic.ejb20.cmp.rdbms.finders.QueryContext;Lweblogic.ejb20.cmp.rdbms.finders.QueryNode;)V(BaseExpr.java:230)
    at weblogic.ejb20.cmp.rdbms.finders.ExprROOT.init_method()V(ExprROOT.java:89)
    at weblogic.ejb20.cmp.rdbms.finders.BaseExpr.init(Lweblogic.ejb20.cmp.rdbms.finders.QueryContext;Lweblogic.ejb20.cmp.rdbms.finders.QueryNode;)V(BaseExpr.java:230)
    at weblogic.ejb20.cmp.rdbms.finders.QueryContext.generateQuery()V(QueryContext.java:91)
    at weblogic.ejb20.cmp.rdbms.finders.Finder.computeSQLQuery(Lweblogic.ejb20.cmp.rdbms.RDBMSBean;)V(Finder.java:1002)
    at weblogic.ejb20.cmp.rdbms.RDBMSBean.generateFinderSQLStatements(Ljava.util.Iterator;)V(RDBMSBean.java:2692)
    at weblogic.ejb20.cmp.rdbms.Deployer.readTypeSpecificData(Ljava.io.InputStream;Ljava.lang.String;)V(Deployer.java:479)
    at weblogic.ejb20.persistence.PersistenceType.setTypeSpecificFile(Lweblogic.ejb20.interfaces.EntityBeanInfo;Lweblogic.ejb20.persistence.spi.CMPDeployer;)V(PersistenceType.java:483)
    at weblogic.ejb20.persistence.PersistenceType.setupDeployer(Lweblogic.ejb20.interfaces.EntityBeanInfo;Ljava.io.File;Lweblogic.utils.Getopt2;Lweblogic.utils.jars.VirtualJarFile;)Lweblogic.ejb20.persistence.spi.CMPDeployer;(PersistenceType.java:414)
    at weblogic.ejb20.deployer.CMPInfoImpl.setup(Ljava.io.File;Lweblogic.utils.Getopt2;Lweblogic.utils.jars.VirtualJarFile;)V(CMPInfoImpl.java:113)
    at weblogic.ejb20.ejbc.EJB20CMPCompiler.generatePersistenceSources(Lweblogic.ejb20.interfaces.EntityBeanInfo;Lweblogic.utils.jars.VirtualJarFile;)Ljava.util.List;(EJB20CMPCompiler.java:64)
    at weblogic.ejb20.ejbc.EJBCompiler.doCompile(Ljava.util.Collection;Lweblogic.utils.jars.VirtualJarFile;)V(EJBCompiler.java:245)
    at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(Lweblogic.utils.classloaders.GenericClassLoader;Lweblogic.management.configuration.EJBComponentMBean;Lweblogic.management.descriptors.toplevel.EJBDescriptorMBean;Lweblogic.utils.jars.VirtualJarFile;Lweblogic.j2ee.valid
    ation.ModuleValidationInfo;Lweblogic.ejb20.ejbc.VersionHelper;Ljava.util.Collection;)V(EJBCompiler.java:468)
    at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(Lweblogic.utils.classloaders.GenericClassLoader;Lweblogic.utils.jars.VirtualJarFile;Lweblogic.j2ee.validation.ModuleValidationInfo;)V(EJBCompiler.java:387)
    at weblogic.appc.compileEJB(Lweblogic.utils.classloaders.GenericClassLoader;Lweblogic.utils.jars.VirtualJarFile;Ljava.io.File;Lweblogic.j2ee.validation.ModuleValidationInfo;)V(appc.java:735)
    at weblogic.appc.compileEJB()V(appc.java:709)
    at weblogic.appc.compileInput()V(appc.java:446)
    at weblogic.appc.runBody()V(appc.java:167)
    at weblogic.utils.compiler.Tool.run([Ljava.lang.String;)V(Tool.java:146)
    at weblogic.utils.compiler.Tool.run()V(Tool.java:103)
    at weblogic.appc.main([Ljava.lang.String;)V(appc.java:961)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    It is a bug for the EJB container to respond with an NPE.
    (It's been fixed in v9 Beta, and it might be fixed in an 8.1 service pack but I can't recall off the top of my head). At any rate, I'm pretty sure that an EJB QL query with an empty WHERE clause will cause this. I would look for a query that ends in ' WHERE'.
    -thorick

  • Where to place an xml file that is read by  java class file  dir structure

    Hello all,
    I have an xml file that I am using in lieu of a database to track conference rooms . This is a small file. I need to read this file from my java class file which is used by a jsp. Currently I have an absolute path C://logger/conference.xml. All works fine but I need to deploy to a different machine soon and so I need to place this file somewhere in the project directory structure (created by netbeans) so that it will be included in the war file and can be read by the java class file.
    Also what would be the relative path to this suggested directory.
    TIA!!!

    public class DOMconference {
        /** Creates a new instance of DOMconference */
        public DOMconference() { }
        //private final static String XML_FILE_NAME = "/opt/conference.xml";//set the output file and location
        public String XML_FILE_NAME = "";
        private final static String FIRST_CONF_ID = "8200";//set the initial conference number
        static Document document;
        public void getFilePath(String path)
            XML_FILE_NAME = path.replaceAll("\\\\","/");
            System.out.println("XML==============="+XML_FILE_NAME);
        File file = new File(XML_FILE_NAME);
        *generic method that returns a Document object
       public Document getDocument() throws SAXException, ParserConfigurationException,
               IOException
           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
           factory.setIgnoringComments(true);
           factory.setCoalescing(true);
           factory.setNamespaceAware(false);
           factory.setValidating(false);
           DocumentBuilder builder = factory.newDocumentBuilder();
           document = builder.parse(file);   //HERE IS WHERE THE ERROR POINT S TO
           return document;
       }Here is the complete error:
    INFO: Server startup in 1282 ms
    XML===============C:/Documents and Settings/gforte/agi/build/web/WEB-INF/conference.xml
    [Fatal Error] bin:1:1: Content is not allowed in prolog.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:172)
    at agi.DOMconference.getDocument(DOMconference.java:91)
    at agi.DOMconference.getLdapConferences(DOMconference.java:466)
    at agi.Ldap.getConferences(Ldap.java:243)
    at org.apache.jsp.test_jsp._jspService(test_jsp.java:111)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
    [Fatal Error] bin:1:1: Content is not allowed in prolog.
    NotifyUtil::java.net.SocketException: Software caused connection abort: recv failed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:606)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:554)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:571)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:936)
    at org.netbeans.modules.web.monitor.server.NotifyUtil$RecordSender.run(NotifyUtil.java:248)
    So if I change my code to this (note that all I change is how the constant XML_FILE_NAME is set and I copy and paste the path that is derived from getFilePath after the String.replaceAll call.):
    public class DOMconference {
        /** Creates a new instance of DOMconference */
        public DOMconference() { }
        private final static String XML_FILE_NAME = "C:/Documents and Settings/gforte/agi/build/web/WEB-INF/conference.xml";//set the output file and location
        //public String XML_FILE_NAME = "";
        private final static String FIRST_CONF_ID = "8200";//set the initial conference number
        static Document document;
        public void getFilePath(String path)
            //XML_FILE_NAME = path;//.replaceAll("\\\\","/");
            System.out.println("XML==============="+XML_FILE_NAME);
        File file = new File(XML_FILE_NAME);
        *generic method that returns a Document object
       public Document getDocument() throws SAXException, ParserConfigurationException,
               IOException
           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
           factory.setIgnoringComments(true);
           factory.setCoalescing(true);
           factory.setNamespaceAware(false);
           factory.setValidating(false);
           DocumentBuilder builder = factory.newDocumentBuilder();
           document = builder.parse(file);
           return document;
       }All is fine..
    Just in case, here is my xml file contents copy and paste from notepad.
    <?xml version="1.0"?><conf_rooms><conf_room><conf_id>8200</conf_id><conf_name>Conference room 1</conf_name></conf_room><conf_room><conf_id>8201</conf_id><conf_name>Conference Room 2</conf_name></conf_room><conf_room><conf_id>8202</conf_id><conf_name>dufus</conf_name></conf_room></conf_rooms>Thanks for hanging in there with me on this.
    Graham

Maybe you are looking for

  • Single Sign on and Macintosh

    Hello, we realized single sign on on our mac machines. It runs great. Now i want to combine it with our SAP logon groups. There's an error that he cannot find the KDC. Where's the problem? Is it nit possible to combine groups with using snc? We set t

  • Windows 8 Consumer Preview: AMD Switchable Graphics - Unswitchable

    Hello everyone, I have a HP Pavillion dv6-6004tx notebook computer, and I recently upgraded it to the Windows 8 Consumer Preview (Build 8250). I would like some troubleshooting from those who have/are experiencing this and may have found a way around

  • Exclude a version from the calculation

    Hello, In our model we have a version used uniquely to upload data. When the system starts to calculate, it includes this version.  We have tried to lock the version,but it still included in the calculation. We would like to know if is possible to ex

  • Error Loading Weather widget when docked

    I just got the multimedia dock for the Droid X and the weather widget fails to load. Any ideas how to repair this and make it work? Thanks for any help in this, love the device as I gave up my iPhone for this and will never go back!!!

  • Major help needed with replacing xskey

    here's the pickle... i lost my logic pro 7 xskey while traveling. i can't install/update studio without it, nor run pro 7. i am currently in a country that doesn't have apple support phone lines. i can't contact any other apple support phone lines fr