Don't understand why this seems to be so difficult to resolve

Am using JWSDP1.3 - ie Tomcat 5 (Beta ???)  + J2SDK1.4.2

from my initialization Code
       System.out.println("Getting Context info");
        Context initCtx = new InitialContext();
        System.out.println("Got Initial Context");
        Context envCtx = (Context)initCtx.lookup("java:comp/env");
        System.out.println("Got JWSDP Environment Context");
        System.out.println("Getting AIMS DataSource");
        DataSource ds = (DataSource)envCtx.lookup("jdbc/AIMS_DB");
        if(ds != null)
        {
                System.out.println("Got AIMS DataSource");
                try{
                        Connection conn = ds.getConnection();
                        System.out.println("Got AIMS DB Connection from
Pool");
                }catch(Exception eX){
                        eX.printStackTrace();
                }
        }
from my Web.xml
    <!--    JNDI Resources   -->
    <resource-ref>
        <description>AIMS DB Connection</description>
        <res-ref-name>jdbc/AIMS_DB</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
from my <xyzContext>.xml
          <ResourceLink name="jdbc/AIMS_DB" global="AIMS_DB"
type="javax.sql.DataSource"/>
        </Context>
from my server.xml
       <GlobalNamingResources>
       ....
       <Resource auth="Container" description="AIMS DB" name="AIMS_DB"
scope="Shareable" type="javax.sql.DataSource"/>
       ....
       <ResourceParams name="AIMS_DB">
             <parameter>
               <name>factory</name>
               <value>com.pervasive.jdbc.v2.DataSourceFactory</value>
             </parameter>
             <parameter>
               <name>url</name>
               <value>jdbc:pervasive://<Host>:<Port>/<DBName></value>
             </parameter>
             <parameter>
               <name>password</name>
               <value><Passwrod></value>
             </parameter>
             <parameter>
               <name>maxWait</name>
               <value>5000</value>
             </parameter>
             <parameter>
               <name>maxActive</name>
               <value>3</value>
             </parameter>
             <parameter>
               <name>driverClassName</name>
               <value>com.pervasive.jdbc.v2.Driver</value>
             </parameter>
             <parameter>
               <name>username</name>
               <value><Username></value>
             </parameter>
             <parameter>
               <name>maxIdle</name>
               <value>2</value>
             </parameter>
           </ResourceParams>
         </GlobalNamingResources>
Deplyment
<xyzContext>.xml is in ...<Catalina>/conf/Catalina/localhost
& I drop my WAR file in ...<Catalina>/myWebApps as referenced by docbase in
<xyzContext>.xml

If I stop/start Tomcat the webApp is picked up 
Have checked this with Tomcat WebApp Manager & Tomcat Web Server Admin

Have used these tools to check env/resource settings - all look OK

WHEN I invoke my webApp
I get the following code trace in the log files
        Getting Context info
        Got Initial Context
        javax.naming.NameNotFoundException: Name java:comp is not bound in
this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:197)
        at javax.naming.InitialContext.lookup(InitialContext.java:347)
        at FDPCalculator.<clinit>(Unknown Source)


ie this line of code fails
        Context envCtx = (Context)initCtx.lookup("java:comp/env");



NOTE I have had the code working fine BEFORE I tried using DataSources 

WHAT I am trying to achieve is the REMOVAL of env variables from my web.xml
(that provide DB setting)
So that I can start using DB Connection pools
(I have other WebApps in a similar state & want to start making use of some
Container managed global DB resources)



Hope someone can help


Sorry this has been a bit long-winded
But I've been going round in circles on this

Regards
Stefan Maric
European Aviation Air Charter
01202 581111 x184


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to