Auto Config Tomcat 5.5 Context.xml

I am trying to set up my app so no Data Source configuration is necessary in Tomcat 5.5 here is my context.xml anybody have any ideas why this isn't working?
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="ElegantMailingTest" docBase="/opt/tomcat5/webapps/ElegantMailingTest.war" path="/ElegantMailingTest" workDir="work/Catalina/localhost/ElegantMailingTest">>
<Resource auth="Container" description="Rave Generated Data Source" name="jdbc/ElegantMailing" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ElegantMailing">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>username</name>
<value>jasonwpalmer</value>
</parameter>
<parameter>
<name>password</name>
<value>******</value> (I Obviously Removed)
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/ElegantMailing?autoReconnect=true</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>30</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
</ResourceParams>
</Context>

Thank you Roman,
I'm sure I have already read those posts before I posted, but somehow when I followed your links back there again, I got it right.
Here is my context.xml that was successful with auto-config
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/ElegantMailingTest">
<Resource driverClassName="org.gjt.mm.mysql.Driver" maxActive="30" maxIdle="10" maxWait="10000" name="jdbc/ElegantMailing" password="788721" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/ElegantMailing?autoReconnect=true" username="jasonwpalmer" validationQuery="select * from validation"/>
</Context>
Roman I have seen your replies all over the threads and I appreciate the time you spend helping us newbies out...really thanx!
Jason

Similar Messages

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

  • Tomcat 5.x, context.xml and the caseSensitive attribute.

    Hi,
    I have already configured a context.xml file in the CATALINA_HOME/conf/Catalina/localhost with the following content:
    <Context path="/mysite" docBase="${catalina.home}/webapps/mysite" reloadable="true"/>
    It is working, because the servlets can be reloaded after a modification. My goal is to make the URL recognition of the server for may web application case-insensitive. There is an attribute caseSensitive in the <Context> element? Is that right? And this can turn off case-sensitivity of this web application. This means it should also affect the URL recognition. But wen I change the line in the context.xml to
    <Context path="/mysite" docBase="${catalina.home}/webapps/mysite" reloadable="true" caseSensitive="false"/>
    and try to access the URL with different case then the original it does not find the page. Is this the right place to put the caseSensitive attribute?

    i am posting the Car.xml which i created in
    /conf/catalina/localhost directory in Tomcat 5.5.7
    ?xml version='1.0' encoding='utf-8'?>
    <Context path ="/Car" docBase="C:\Program
    Files\Apache Software Foundation\Tomcat
    5.5\webapps\Car" debug="0" />Rather than have you working directory under webapps, you can have it elsewhere in your system and refer to it using the docBase attribute. For example, say you have your work directory in d:\work\car,
    then
    <?xml version='1.0' encoding='utf-8'?>
    <Context  path ="/Car" docBase="d:/work/car"  />would suffice.
    cheers,
    ram.

  • Tomcat 5.x context.xml problem

    Hi All
    Have been using Tomcat after a long time. Previously in Tomcat 4.x when one had to define their own conext say "car" you need to make changes in the conf/server.xml
    But Tomcat 5.x says u need to create a separate xml file in this case car.xml in the /conf/Catalina/localhost directory. I did the same and played around a bit but still i doesnt work
    Is there anything else that needs to be done other than this ? Has anybody faced the same prob
    thnks in advance
    cheers
    j2eerookie

    i am posting the Car.xml which i created in
    /conf/catalina/localhost directory in Tomcat 5.5.7
    ?xml version='1.0' encoding='utf-8'?>
    <Context path ="/Car" docBase="C:\Program
    Files\Apache Software Foundation\Tomcat
    5.5\webapps\Car" debug="0" />Rather than have you working directory under webapps, you can have it elsewhere in your system and refer to it using the docBase attribute. For example, say you have your work directory in d:\work\car,
    then
    <?xml version='1.0' encoding='utf-8'?>
    <Context  path ="/Car" docBase="d:/work/car"  />would suffice.
    cheers,
    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

  • 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 :/

  • Tomcat application context.xml

    This is my problem:
    I've been programming my own implementation of a Realm.
    within I want to access a <Environment>-Entry situated in
    a customized Context.xml :
    <Context docBase="${catalina.home}/webapps/slide"
    privileged="true" antiResourceLocking="false"
    antiJARLocking="false" useNaming="true">
    <Environment name="test" type="java.lang.String"
    value="C:/user.xml"/>
              <Realm className="MyRealm"/>
    </Context>
    What do I need to do to gain access.
    When I declare the variable in <GlobalNamingResources> there is no problem accessing it.

    To clarify I add portions of my configuration files:
    <b>hibernate.cfg.xml</b> fragment:
    <property name="connection.datasource">
      java:comp/env/jdbc/cname
    </property>
    <property name="dialect">
      net.sf.hibernate.dialect.OracleDialect
    </property>
    <property name="connection.driver_class">
      oracle.jdbc.driver.OracleDriver
    </property>
    <property name="transaction.factory_class">
      net.sf.hibernate.transaction.JDBCTransactionFactory
    </property> <b>web.xml</b> fragment:
    <resource-ref>
      <description>DataSource</description>
      <res-ref-name>jdbc/cname</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>What I want to put inside <b>tomcat context application definition</b>:
    <Resource name="jdbc/cname" scope="Shareable" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/cname">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:oracle:thin:@server:1521:SID</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>oracle.jdbc.driver.OracleDriver</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>name</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>pass</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>3000</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>100</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>10</value>
      </parameter>
    </ResourceParams>
    <Realm className="org.apache.catalina.realm.DataSourceRealm"
       dataSourceName="jdbc/cname"
       localDataSource="true"
       digest="MD5"
       userTable="usr" userNameCol="user" userCredCol="passwd"
       userRoleTable="usrrol" roleNameCol="rol" />

  • Context.xml for Tomcat using Weblogic JMS

    Hello,
              has anyone succeeded in getting Tomcat to use a queue hosted by Weblogic? If so, could you please post a snippet of your context.xml with the <Resource>... sections appropriate? My last attempt drowned in a sea of bizarre security exceptions and hasn't been seen since.
              Thanks,
              Richard

    Tom,
              I'll see what happens when I move things about, but really, there's a difference here. One of the issues here is that Tomcat needs a class that implements the ReferenceFactory interface for its configuration. I can't find such a class in the Weblogic docs, but I might have it all wrong or be looking in the wrong place. Hence, my question.
              The weblogic jar is not in the Tomcat classpath, it's in the WEB-INF/lib directory of the war file I'm working with.

  • Apache server - tomcat - jk, virtual hosts, database/context.xml question?

    Hello,
    I have an web application that runs perfectly in Tomcat 5.5 when running tomcat stand-alone.
    I also have Apache HTTP server integrated with Tomcat using the jk connector and running virtual hosts in a mod_jk.conf file, which is working for html files. When I run apache and tomcat at the same time, the jsp opens but the servlet cannot get a database connection.
    To run virtual hosts and apache and tomcat, I added this host container to server.xml:
    <Host name="www.mydomain.com" debug="0" appBase="d:/WebApps/mydomain"
    unpackWARs="true" autoDeploy="true">
    <Context path="" docBase="" debug="0"/>
    </Host>
    Does anybody see anything wrong with this? Is there some reason why the context.xml (which contains the database info) is not being read?
    Any suggestions are greatly appreciated.
    Thank you,
    Logan

    Hi,
    In the docmentation of Tomcat 5.x is written that is not recommended to put <context> element in the server.xml file. Create a file in CATALINA_HOME/conf/Catalina/www.mydomain.com/ with an XML extension. For example context.xml. In files like this you should write all of your <context> elements.

  • Connection config in context.xml

    Hi,
    How to specify the following in context.xml resource tag?
    jdbc:mysql://localhost:3308/test?characterEncoding=UTF-8&useUnicode=true
    Thank you.

    From HttpSession:
              setMaxInactiveInterval(int interval)
              Specifies the time, in seconds, between client requests before the servlet
              container will invalidate this session.
              Cameron Purdy
              "Olivier Brand" <[email protected]> wrote in message
              news:[email protected]..
              > As the documentation and the Servlet specifications specify, the session
              > timeout is expressed in minutes.
              >
              > We have set the tag to 30 and it appeared that the session was being
              > flushed every 30 seconds.
              >
              > Could somebody confirm this behavior ?
              >
              > Thanks
              >
              > Olivier
              >
              >
              

  • Tomcat 5.5.7 and context.xml

    I am having difficulty corrcetly setting up the context.xml file. Perhaps someone can shed some insight as to how to do this...
    I have a .war file called myWar.war I place this in the webapps directory
    I want to use a path of a/b to access it.
    so, if my browser url is
    http://localhost:8080/a/b/html/index.html it will actually access webapp/myWar/html/index.html
    I keep reading things that confuse me as to how to do this. Do I need something called context.xml, ROOT.xml, or myWar.xml. Also do I place it in the conf/Catalina/localhost directory r in the myWar/Meta-Inf directory
    thank you

    I remember reading something about the path value not being recognized for 5.5.x . It seems to validate it in the documentation below. I don't know how to 'fix' it though...
    "The context path of this web application, which is matched against the beginning of each request URI to select the appropriate web application for processing. All of the context paths within a particular Host must be unique. If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts. The value of this field must not be set except when statically defining a Context in server.xml, as it will be infered from the filenames used for either the .xml context file or the docBase."

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

    Hello!
    Where the context.xml (tomcat) file should be, in catalina_home or in catalina_base?
    Thanks.

    Both, but wrong forum and off topic for the site. Try the Tomcat documentation.

  • Outlook 2010 Auto Config doesnt tick the "use outgoing mail server auth" settings

    Hi Guys
    I've got a domain here and an auto-config setup for Outlook whereby it goes to a website on the domain controller and downloads an xml looking like this:
    <?xml version='1.0' encoding='utf-8' ?>
    <Autodiscover xmlns='http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006'>
    <Response xmlns='http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a'>
    <User>
    <DisplayName>User Name</DisplayName>
    </User>
    <Account>
    <AccountType>email</AccountType>
    <Action>settings</Action>
    <Protocol>
    <Type>IMAP</Type>
    <Server>mail.host.com</Server>
    <Port>143</Port>
    <LoginName>[email protected]</LoginName>
    <DomainRequired>off</DomainRequired>
    <SPA>off</SPA>
    <SSL>off</SSL>
    <AuthRequired>on</AuthRequired>
    </Protocol>
    <Protocol>
    <Type>SMTP</Type>
    <Server>mail.host.com</Server>
    <Port>25</Port>
    <LoginName>[email protected]</LoginName>
    <DomainRequired>off</DomainRequired>
    <SPA>off</SPA>
    <SSL>off</SSL>
    <AuthRequired>on</AuthRequired>
    <UsePOPAuth>on</UsePOPAuth>
    <SMTPLast>on</SMTPLast>
    </Protocol>
    </Account>
    </Response>
    </Autodiscover>
    As can be seen, we use IMAP here rather than exchange
    Now, when I go to set up an account, outlook DOES configure most things presented in this XML, but there seems to be a bug in that while it knows and enables "My outgoing server(SMTP) requires authentication" checkbox, it DOESN'T then enable the relevant
    radio button that one would assume <UsePOPAuth> (== use the same settings as my incoming server) intends.. No radio button is checked, which means that mails do NOT send :/
    Here's a pic:
    So, alas, my auto-setup still requires the depeest level of manual interaction to set it up.. i.e. it's fairly useless. I'd say for sure this is a bug in outlook's auto config, but how to report it to microsoft?

    Hello,
    Thank you for your report. I am trying to involve someone familiar with this topic to further look at this issue.
    Tony Chen
    TechNet Community Support
    A new Office has arrived, try it now.
    A beautiful Start. It begins here. Windows 8 and Windows RT.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

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

Maybe you are looking for

  • How can I get the styleID of a page

    Hi all, my problem is to get the style_id of a page with java methods. Everythig else I can get, but not the style_id!!! I need it for using the same style in a popup window. Best regards, Michael

  • Delete values for a range

    Hi ,      I want to delete records only for a given range. Below is the script it deletes the records based on the given MP range. And in this Switch table screen shot i have a switchID and ControlPointID column as main reference . For the given rang

  • I don't got my pictures back from iTunes backup

    I restored my iPhone trough iTunes and I did a backup before I restored it. But then when I restore the backup to my iPhone. I got everything back but I didn't got my pictures back. How can I solve this because I did a backup with iTunes.

  • Error message "iTunes cannot add any songs to the iPhone because no more free space is available"

    I have an iPhone 4, and have over 2 gigs of storage space left, yet iTunes gives me this error message anytime I try to add even 1 song from my computer to my phone. I can still download apps from the app store, and can still download content from th

  • Accessing the outerclass object inside the innerclass

    hi, plz can any one tell me how can i access the object of the outer class using which i instantiate an inner class inside this inner class. My inner class in a non-static class.