I was just about to reply to this :) But does anyone know why you can't
define the <Resource> in the <GlobalNamingResources> tag? According to the
documentation you should be able to and your JNDI resource should be
available to all contexts. The reason i ask is that i was trying to set up a
DataSource for use by a webservice app and every time you redeploy a
webservice using the Manager App the <context> node gets rewritten and you
have to manually add the <resource> and <resourceParams> again, very
irritating....
tom
> -----Original Message-----
> From: James Maggs [mailto:james.maggs@virgin.net]
> Sent: 29 April 2003 11:29
> To: Tomcat Users List
> Subject: [SOLVED]: Tomcat Ignoring JNDI Resource Parameters
>
>
> Hi Eric,
>
> Thanks for your reply but as in most cases as soon as you ask for
> help, you
> find the solution yourself.
>
> The problem was that in the server.xml file the <Resource> and
> <ResourceParams> were defined outside of the <Context>. My server.xml now
> looks like this and everything is working fine:
>
> <Host name="www.myhost.com" debug="0"
> appBase="webapps" unpackWARs="true" autoDeploy="true">
>
> <Context path="" docBase="/usr/local/www/myhost.com/htdocs"
> reloadable="true" crossContext="true" debug="5">
>
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="localhost_myhost_log." suffix=".txt"
> timestamp="true"/>
>
> <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs" prefix="myhost_access_log." suffix=".txt"
> pattern="common" resolveHosts="false"/>
>
> <Realm className="org.apache.catalina.realm.JDBCRealm"
> debug="99"
> driverName="org.gjt.mm.mysql.Driver"
> connectionURL="jdbc:mysql://localhost:3306/DB"
> connectionName="user"
> connectionPassword="password"
> userTable="USERS" userNameCol="USERNAME"
> userCredCol="PASSWORD"
> userRoleTable="USER_ROLES" roleNameCol="ROLENAME" />
>
> <Resource name="jdbc/MyhostDB"
> auth="Container"
> type="javax.sql.DataSource"/>
>
> <ResourceParams name="jdbc/MyhostDB">
> <parameter>
> <name>factory</name>
>
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> </parameter>
> <parameter>
> <name>maxActive</name>
> <value>50</value>
> </parameter>
> <parameter>
> <name>maxIdle</name>
> <value>10</value>
> </parameter>
> <parameter>
> <name>maxWait</name>
> <value>10000</value>
> </parameter>
> <parameter>
> <name>username</name>
> <value>user</value>
> </parameter>
> <parameter>
> <name>password</name>
> <value>password</value>
> </parameter>
> <parameter>
> <name>driverClassName</name>
> <value>org.gjt.mm.mysql.Driver</value>
> </parameter>
> <parameter>
> <name>url</name>
>
> <value>jdbc:mysql://localhost:3306/DB?autoReconnect=true</value>
> </parameter>
> </ResourceParams>
>
> </Context>
>
> </Host>
>
> I hope this solution helps others because I've been staring at
> this problem
> for hours!
>
> Thanks again,
>
> -James
>
> ----- Original Message -----
> From: "Roberts, Eric" <Eric.Roberts@one.at>
> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>; "James Maggs"
> <james.maggs@virgin.net>
> Sent: Tuesday, April 29, 2003 11:20 AM
> Subject: RE: Tomcat Ignoring JNDI Resource Parameters
>
>
> > James,
> >
> > What do you have in your web.xml?
> >
> > If you refer to the resources in your web.xml try removing those
> references.
> >
> > HTH
> >
> > -----Original Message-----
> > From: James Maggs [mailto:james.maggs@virgin.net]
> > Sent: 29 April 2003 12:04
> > To: Tomcat Users List
> > Subject: Re: Tomcat Ignoring JNDI Resource Parameters
> >
> >
> > Sorry, the log entries below should read as follows:
> >
> > NamingContextListener[/localhost/www.myhost.com]: Creating JNDI naming
> > context
> > NamingContextListener[/localhost/www.myhost.com]: Resource parameters
> for
> > jdbc/MyhostDB = null
> > NamingContextListener[/localhost/www.myhost.com]: Adding resource ref
> > jdbc/MyhostDB
> > NamingContextListener[/localhost/www.myhost.com]:
> >
> ResourceRef[className=javax.sql.DataSource,factoryClassLocation=nu
> ll,factory
> >
> ClassName=org.apache.naming.factory.ResourceFactory,{type=descript
> ion,conten
> > t=DB
> >
> Connection},{type=scope,content=Shareable},{type=auth,content=Container}]
> > NamingContextListener[/localhost/www.myhost.com]: Resource parameters
> for
> > UserTransaction = null
> >
> > Thanks.
> >
> > -James
> >
> > ----- Original Message -----
> > From: "James Maggs" <james.maggs@virgin.net>
> > To: <tomcat-user@jakarta.apache.org>
> > Sent: Tuesday, April 29, 2003 10:57 AM
> > Subject: Tomcat Ignoring JNDI Resource Parameters
> >
> >
> > > Hi There,
> > >
> > > I've been struggling with a JNDI DataSource setup under Tomcat 4.1.18.
> The
> > > problem seems to be that while the <Resource> tag is processed, the
> > > <ResourceParams> are completely ignored. Output in my log
> file confirms
> > > this. Here's the relevant portion of my server.xml:
> > >
> > > <Host name="www.myhost.com" debug="0"
> > > appBase="webapps" unpackWARs="true" autoDeploy="true">
> > >
> > > <Context path="" docBase="/usr/local/www/myhost.com/htdocs"
> > > reloadable="true" crossContext="true" debug="5"/>
> > >
> > > <Logger className="org.apache.catalina.logger.FileLogger"
> > > prefix="localhost_myhost_log." suffix=".txt"
> timestamp="true"/>
> > >
> > > <Valve className="org.apache.catalina.valves.AccessLogValve"
> > > directory="logs" prefix="myhost_access_log." suffix=".txt"
> > > pattern="common" resolveHosts="false"/>
> > >
> > > <Realm className="org.apache.catalina.realm.JDBCRealm"
> debug="99"
> > > driverName="org.gjt.mm.mysql.Driver"
> > > connectionURL="jdbc:mysql://localhost:3306/DB"
> > > connectionName="user"
> > > connectionPassword="password"
> > > userTable="USERS" userNameCol="USERNAME"
> userCredCol="PASSWORD"
> > > userRoleTable="USER_ROLES" roleNameCol="ROLENAME" />
> > >
> > > <Resource name="jdbc/MyhostDB"
> > > auth="Container"
> > > type="javax.sql.DataSource"/>
> > >
> > > <ResourceParams name="jdbc/MyhostDB">
> > > <parameter>
> > > <name>factory</name>
> > >
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> > > </parameter>
> > > <parameter>
> > > <name>maxActive</name>
> > > <value>50</value>
> > > </parameter>
> > > <parameter>
> > > <name>maxIdle</name>
> > > <value>10</value>
> > > </parameter>
> > > <parameter>
> > > <name>maxWait</name>
> > > <value>10000</value>
> > > </parameter>
> > > <parameter>
> > > <name>username</name>
> > > <value>user</value>
> > > </parameter>
> > > <parameter>
> > > <name>password</name>
> > > <value>password</value>
> > > </parameter>
> > > <parameter>
> > > <name>driverClassName</name>
> > > <value>org.gjt.mm.mysql.Driver</value>
> > > </parameter>
> > > <parameter>
> > > <name>url</name>
> > >
> > <value>jdbc:mysql://localhost:3306/DB?autoReconnect=true</value>
> > > </parameter>
> > > </ResourceParams>
> > >
> > > </Host>
> > >
> > > And in my localhost_myhost_log.txt file I see the following:
> > >
> > > NamingContextListener[/localhost/www.seeran.com]: Creating JNDI naming
> > > context
> > > NamingContextListener[/localhost/www.seeran.com]: Resource
> parameters
> > for
> > > jdbc/SeeranDB = null
> > > NamingContextListener[/localhost/www.seeran.com]: Adding
> resource ref
> > > jdbc/SeeranDB
> > > NamingContextListener[/localhost/www.seeran.com]:
> > >
> >
> ResourceRef[className=javax.sql.DataSource,factoryClassLocation=nu
> ll,factory
> > >
> >
> ClassName=org.apache.naming.factory.ResourceFactory,{type=descript
> ion,conten
> > > t=DB
> > >
> Connection},{type=scope,content=Shareable},{type=auth,content=Container}]
> > > NamingContextListener[/localhost/www.seeran.com]: Resource
> parameters
> > for
> > > UserTransaction = null
> > >
> > > Tomcat starts up without any errors and the default DataDource is
> created
> > > under the correct JNDI location but as soon as I try and get a
> connection
> > a
> > > NullPointerException is thrown. Not surprising given that the
> properties
> > are
> > > ignored. Can anyone see a problem with my configuration?
> > >
> > > Many thanks in advance,
> > >
> > > -James
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
|