Ok, so changing the "dataSourceName" attribute in the Realm config (as you suggest which contradicts the HOWTO) to the short name I've given my resource makes the Realm auth work with the globally defined datasource. Yay!
However, when trying to connect to the datasource (moved the "jdbc/Auth" resource from <DefaultContext> tag to <GlobalNamingResources> tag), my servlet application still gives the same "Name jdbc is not bound in this Context" error. You mention not having to put a <resource-ref> in the context specific web.xml file, and I assume your suggestion to put <ResourceLink> tag in the Context (in my case putting it in the <DefaultContext> tag so it works, or should, for all autodeployed contexts) is what you mean removes the need for the those aforementioned entries. However, it doesn't appear to work (as it _does_ work when I move the whole <Resource>/<ResourceParams> tags into the <DefaultContext> tag. Don't want to do this as I will have multiple virtual hosts using the same resource...) Doubt it's of importance, but adding the <resource-ref> you suggest is not necessary produces the elusive "Cannot load JDBC driver class 'null'" error, which I believe is unrelated. Any more ideas why my app would not see the global resource as defined below as a global resource and then resource-linked in the default context? -----Original Message----- From: Scott Stewart [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 5:27 PM To: 'Tomcat Users List' Subject: RE: JNDI DataSource Realm I posted this awhile back (for MySQL), but here it is again. Also, when you define your DataSource in this manner, you do not need the <resource-ref> node in your context-specific web.xml files. The global DataSource definition -------------------------------- <!-- Global JNDI resources --> <GlobalNamingResources> <!-- Editable user database that can also be used by JNDI DatabaseRealm to authenticate users --> <Resource name="jdbc/MySQLConnectPool" auth="Container" type="javax.sql.DataSource" /> <ResourceParams name="jdbc/MySQLConnectPool" > <parameter> <name>username</name> <value>????????</value> </parameter> <parameter> <name>password</name> <value>????????</value> </parameter> <parameter> <name>driverClassName</name> <value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc:mysql://<your IP here>:3306/<your DB name here>?autoReconnect=true</value> </parameter> <parameter> <name>removeAbandoned</name> <value>true</value> </parameter> <parameter> <name>removeAbandonedTimeout</name> <value>60</value> </parameter> <parameter> <name>logAbandoned</name> <value>true</value> </parameter> <parameter> <name>maxActive</name> <value>200</value> </parameter> <parameter> <name>maxIdle</name> <value>30000</value> </parameter> <parameter> <name>maxWait</name> <value>100</value> </parameter> </ResourceParams> </GlobalNamingResources> Realm definition using global DataSource ---------------------------------------- <Realm className="org.apache.catalina.realm.DataSourceRealm" dataSourceName="jdbc/MySQLConnectPool" userTable="customers" userNameCol="customer_username" userCredCol="customer_password" userRoleTable="roles" roleNameCol="role" debug="0" /> Context reference to global DataSource -------------------------------------- <ResourceLink name="jdbc/MySQLConnectPool" global="jdbc/MySQLConnectPool" type="javax.sql.DataSource" /> Hope this helps!! Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] ClearSky Mobile Media, Inc. 56 E. Pine St. Suite 200 Orlando, FL 32801 USA -----Original Message----- From: Madere, Colin [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 5:17 PM To: 'Tomcat Users List' Subject: JNDI DataSource Realm Tomcat 4.1.27 PostgreSQL 7.3.4 pg73jdbc3.jar Trying to use JNDI as a Realm source for both auth and data access for a whole server, therefore trying as a GlobalNamingContext attribute. No love. * Set up as a JDBC Realm, auth works. * Set up Datasource as JNDI Resource within <DefaultContext>, data access works. Move <Resource> and params to <GlobalNamingContext> and I get the "Name jdbc is not bound in this Context" error. Saw lots of refs to this error via Google, but none relevant AFAICT. (Do I look up resources in the global context differently? If so doesn't that kind of break the idea of it being an abstractly defined data source?) Anyone successfully using <GlobalNamingContext> for DataSources? Using these components (Tomcat 4.1.x, postgreSQL)? Change Realm from JDBC to DataSourceRealm and auth does not work (or report any errors in logs). server.xml (with DataSourceRealm commented out) <Server port="8005" shutdown="SHUTDOWN" debug="0"> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/> <!-- Global JNDI resources --> <GlobalNamingResources> </GlobalNamingResources> <!-- Define the Tomcat Stand-Alone Service --> <Service name="Tomcat-Standalone"> <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 --> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" useURIValidationHack="false" disableUploadTimeout="true" /> <!-- Note : To disable connection timeouts, set connectionTimeout value to -1 --> <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 --> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8009" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="10" debug="0" connectionTimeout="0" useURIValidationHack="false" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/> <!-- Define the top level container in our container hierarchy --> <Engine name="Standalone" defaultHost="localhost" debug="0"> <!-- Global logger unless overridden at lower levels --> <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/> <!-- Because this Realm is here, an instance will be shared globally --> <!-- <Realm className="org.apache.catalina.realm.DataSourceRealm" debug="99" dataSourceName="java:/comp/env/jdbc/Auth" userTable="Account" userNameCol="username" userCredCol="password" userRoleTable="AccountRole" roleNameCol="role_name"/> --> <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99" driverName="org.postgresql.Driver" connectionURL="jdbc:postgresql://localhost/www_auth" connectionName="www" userTable="Account" userNameCol="username" userCredCol="password" userRoleTable="AccountRole" roleNameCol="role_name"/> <!-- Define the default virtual host --> <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.authenticator.SingleSignOn" debug="0"/> <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/> <!-- <Context path="" docBase="ROOT" debug="0"/> --> <DefaultContext> <Resource name="jdbc/Auth" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/Auth"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>maxActive</name> <value>100</value> </parameter> <parameter> <name>maxIdle</name> <value>30</value> </parameter> <parameter> <name>maxWait</name> <value>10000</value> </parameter> <parameter> <name>username</name> <value>www</value> </parameter> <parameter> <name>password</name> <value></value> </parameter> <parameter> <name>driverClassName</name> <value>org.postgresql.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc:postgresql://localhost/www_auth</value> </parameter> </ResourceParams> </DefaultContext> </Host> </Engine> </Service> </Server> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]