tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sven morales <aka_ser...@yahoo.com>
Subject Re: Difficulty connecting to DB2 for iSeries from Tomcat 5.0.28
Date Mon, 20 Dec 2004 19:42:38 GMT
Hi,
   I have not seen a context.xml file with those dual 
<ResourceLink ...>.  Furthermore, the way you have the
Resource/ResourceParams defined under <GlobalResource>
seems to be not nested properly.  

aka_sergio

--- David Uctaa <ductaa@gmail.com> wrote:

> I am running Tomcat 5.0.28 on Win XP SP1.  We have
> DB2 running on 2
> iSeries servers.  When I attempt to look up a
> DataSource from JNDI to
> get a connection from it, the JNDI lookup is
> returning null.
> 
> I am using IBM's JTOpen library for the JDBC
> drivers, and I am
> attempting to use Tomcat to manage the connection
> pooling.  I am
> following the instructions I saw listed here: 
> http://www.itjungle.com/fhg/fhg060204-story01.html .
>   I am trying the
> first option, using the Commons DBCP connection
> pool.
> 
> I have attached copies of my server.xml and the
> context configuration
> file webappname.xml.  The code I am using to access
> the data source is
> pretty generic:
> 
> Context initCtx = new InitialContext();
> Context ctx = (Context)
> initCtx.lookup("java:comp/env");
> DataSource ds = (DataSource)
> ctx.lookup("jdbc/myFirstDataSource");
> Connection conn = ds.getConnection();
> 
> It turns out the that ctx.lookup call is returning
> null, as if it
> can't find the JNDI resource, and I can't figure out
> what I have
> misconfigured.
> 
> Any and all help will be greatly appreciated.
> > <?xml version='1.0' encoding='utf-8'?>
> <Context displayName="WebAppName"
> docBase="WebAppName" path="/WebAppName"
> privileged="true"
> workDir="work\Catalina\localhost\webappname">
>   <ResourceLink global="jdbc/myFirstDataSource"
> name="jdbc/myFirstDataSource"
> type="javax.sql.DataSource"/>
>   <ResourceLink global="jdbc/mySecondDataSource"
> name="jdbc/mySecondDataSource"
> type="javax.sql.DataSource"/>
> </Context>
> 
> 
> > <?xml version='1.0' encoding='utf-8'?>
> <Server>
>   <Listener
>
className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
>   <Listener
>
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
>   <GlobalNamingResources>
>     <Resource
>
type="com.ibm.as400.access.AS400JDBCConnectionPoolDataSource"
> auth="container" name="jdbc/myFirstDataSource"/>
>     <Resource
>
type="com.ibm.as400.access.AS400JDBCConnectionPoolDataSource"
> auth="container" name="jdbc/mySecondDataSource"/>
>     <ResourceParams name="UserDatabase">
>       <parameter>
>         <name>factory</name>
>        
>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
>       </parameter>
>       <parameter>
>         <name>pathname</name>
>         <value>conf/tomcat-users.xml</value>
>       </parameter>
>     </ResourceParams>
>     <ResourceParams name="jdbc/myFirstDataSource">
>       <parameter>
>         <name>factory</name>
>        
>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>       </parameter>
>       <parameter>
>         <name>driverClassName</name>
>        
> <value>com.ibm.as400.access.AS400JDBCDriver</value>
>       </parameter>
>       <parameter>
>         <name>url</name>
> 
>
<value>jdbc:as400://as400.oursite.com;prompt=false;naming=sql;trace=false;libraries=*LIBL
>         </value>
>       </parameter>
>       <parameter>
>         <name>password</name>
>         <value>abcdefg</value>
>       </parameter>
>       <parameter>
>         <name>username</name>
>         <value>123456</value>
>       </parameter>
>       <parameter>
>         <name>maxWait</name>
>         <value>5000</value>
>       </parameter>
>       <parameter>
>         <name>maxActive</name>
>         <value>4</value>
>       </parameter>
>       <parameter> 
>       	<name>prompt</name>
>       	<value>false</value>
>       </parameter>
>       <parameter> 
>       	<name>trace</name>
>       	<value>false</value>
>       </parameter>
>       <parameter> 
>       	<name>naming</name>
>       	<value>system</value>
>       </parameter>
>       <parameter>
>         <name>maxIdle</name>
>         <value>2</value>
>       </parameter>
>     </ResourceParams>
>     <ResourceParams name="jdbc/mySecondDataSource">
>       <parameter>
>         <name>factory</name>
>        
>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>       </parameter>
>       <parameter>
>         <name>driverClassName</name>
>        
> <value>com.ibm.as400.access.AS400JDBCDriver</value>
>       </parameter>
>       <parameter>
>         <name>url</name>
> 
>
<value>jdbc:as400://abcde.oursite.com;prompt=false;naming=sql;trace=false;libraries=*LIBL
>         </value>
>       </parameter>
>       <parameter>
>         <name>password</name>
>         <value>xyz</value>
>       </parameter>
>       <parameter>
>         <name>username</name>
>         <value>98765</value>
>       </parameter>
>       <parameter>
>         <name>maxWait</name>
>         <value>5000</value>
>       </parameter>
>       <parameter>
>         <name>maxActive</name>
>         <value>4</value>
>       </parameter>
>       <parameter> 
>       	<name>prompt</name>
>       	<value>false</value>
>       </parameter>
>       <parameter> 
>       	<name>trace</name>
>       	<value>false</value>
>       </parameter>
>       <parameter> 
>       	<name>naming</name>
>       	<value>system</value>
>       </parameter>
>       <parameter>
>         <name>maxIdle</name>
>         <value>2</value>
>       </parameter>
>     </ResourceParams>
>   </GlobalNamingResources>
>   <Service name="Catalina">
>     <Connector acceptCount="100"
> connectionTimeout="20000"
> disableUploadTimeout="true" port="8080"
> redirectPort="8443" maxSpareThreads="75"
> maxThreads="150" minSpareThreads="25">
>     </Connector>
>     <Connector port="8009" protocol="AJP/1.3"
>
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
> redirectPort="8443">
>     </Connector>
>     <Engine defaultHost="localhost" name="Catalina">
>       <Host appBase="webapps" name="localhost">
>         <Logger
> className="org.apache.catalina.logger.FileLogger"
> prefix="localhost_log." suffix=".txt"
> timestamp="true"/>
>       </Host>
>       <Logger
> className="org.apache.catalina.logger.FileLogger"
> prefix="catalina_log." suffix=".txt"
> timestamp="true"/>
>       <Realm
>
className="org.apache.catalina.realm.UserDatabaseRealm"/>
>     </Engine>
>   </Service>
> </Server>
> 
> 
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
tomcat-user-help@jakarta.apache.org



		
__________________________________ 
Do you Yahoo!? 
Send a seasonal email greeting and help others. Do good. 
http://celebrity.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message