JNDI Datasource Problem
I've read through every archive that I can find, and I've tried every suggestion that I've seen including the tutorials on the Tomcat site. I'm using 5.5.x, and I can't connect to the database. This is killing me. I've pasted my server.xml, context.xml, and web.xml files here. Any help would be heaven. Thanks in advance, --Melih !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource !-- Uncomment this to disable session persistence across Tomcat restarts -- !-- Manager pathname= / -- ResourceLink name=jdbc/TestDB type=javax.sql.DataSource global=jdbc/TestDB/ /Context web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app !-- Example Server Configuration File -- !-- Note that component elements are nested corresponding to their parent-child relationships with each other -- !-- A Server is a singleton element that represents the entire JVM, which may contain one or more Service instances. The Server listens for a shutdown command on the indicated port. Note: A Server is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- Server port=8005 shutdown=SHUTDOWN !-- Comment these entries out to disable JMX MBeans support used for the administration web application -- Listener className=org.apache.catalina.core.AprLifecycleListener / Listener className=org.apache.catalina.mbeans.ServerLifecycleListener / Listener className= org.apache.catalina.mbeans.GlobalResourcesLifecycleListener / Listener className= org.apache.catalina.storeconfig.StoreConfigLifecycleListener/ !-- Global JNDI resources -- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / Resource name=jdbc/TestDB auth=Container type= javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=root password=1984melih driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/ /GlobalNamingResources !-- A Service is a collection of one or more Connectors that share a single Container (and therefore the web applications visible within that Container). Normally, that Container is an Engine, but this is not required. Note: A Service is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- !-- Define the Tomcat Stand-Alone Service -- Service name=Catalina !-- A Connector represents an endpoint by which requests are received and responses are returned. Each Connector passes requests on to the associated Container (normally an Engine) for processing. By default, a non-SSL HTTP/1.1 Connector is established on port 8080. You can also enable an SSL HTTP/1.1 Connector on port 8443 by following the instructions below and uncommenting the second Connector entry. SSL support requires the following steps (see the SSL Config HOWTO in the Tomcat 5 documentation bundle for more detailed instructions): * If your JDK version 1.3 or prior, download and install JSSE 1.0.2or later, and put the JAR files into $JAVA_HOME/jre/lib/ext. * Execute: %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows) $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix) with a password value of changeit for both the certificate and the keystore itself. By default, DNS lookups are enabled when a web application calls request.getRemoteHost(). This can have an adverse impact on performance, so you can disable it by setting the enableLookups attribute to false. When DNS lookups are disabled, request.getRemoteHost() will return the String version of the IP address of the remote client. -- !-- Define a non-SSL HTTP/1.1 Connector on port 8080 -- Connector port=8080 maxHttpHeaderSize=8192 maxThreads=150 minSpareThreads=25
Re: JNDI Datasource Problem
Also, the error message itself is: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: java.sql.SQLException: No driver found for jdbc/TestDB org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276) and I have mysql-connector-java-5.0.5-bin.jar in {CATALINA_HOME}\common\lib On 4/2/07, Melih Onvural [EMAIL PROTECTED] wrote: I've read through every archive that I can find, and I've tried every suggestion that I've seen including the tutorials on the Tomcat site. I'm using 5.5.x, and I can't connect to the database. This is killing me. I've pasted my server.xml, context.xml, and web.xml files here. Any help would be heaven. Thanks in advance, --Melih !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource !-- Uncomment this to disable session persistence across Tomcat restarts -- !-- Manager pathname= / -- ResourceLink name=jdbc/TestDB type=javax.sql.DataSource global=jdbc/TestDB/ /Context web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd version=2.4 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app !-- Example Server Configuration File -- !-- Note that component elements are nested corresponding to their parent-child relationships with each other -- !-- A Server is a singleton element that represents the entire JVM, which may contain one or more Service instances. The Server listens for a shutdown command on the indicated port. Note: A Server is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- Server port=8005 shutdown=SHUTDOWN !-- Comment these entries out to disable JMX MBeans support used for the administration web application -- Listener className=org.apache.catalina.core.AprLifecycleListener / Listener className=org.apache.catalina.mbeans.ServerLifecycleListener / Listener className= org.apache.catalina.mbeans.GlobalResourcesLifecycleListener / Listener className= org.apache.catalina.storeconfig.StoreConfigLifecycleListener/ !-- Global JNDI resources -- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / Resource name=jdbc/TestDB auth=Container type= javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=root password=1984melih driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/ /GlobalNamingResources !-- A Service is a collection of one or more Connectors that share a single Container (and therefore the web applications visible within that Container). Normally, that Container is an Engine, but this is not required. Note: A Service is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- !-- Define the Tomcat Stand-Alone Service -- Service name=Catalina !-- A Connector represents an endpoint by which requests are received and responses are returned. Each Connector passes requests on to the associated Container (normally an Engine) for processing. By default, a non-SSL HTTP/1.1 Connector is established on port 8080. You can also enable an SSL HTTP/1.1 Connector on port 8443 by following the instructions below and uncommenting the second Connector entry. SSL support requires the following steps (see the SSL Config HOWTO in the Tomcat 5 documentation bundle for more detailed instructions): * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or later, and put the JAR files into $JAVA_HOME/jre/lib/ext. * Execute: %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows) $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix) with a password value of changeit for both the certificate and the keystore itself. By default, DNS lookups are enabled when a web
Re: JNDI Datasource Problem
Is the Context associated with a Host? I tried and example as shown here: http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html and it works fine. I think the same instructions work for Tomcat 5.5.x as well. My server.xml Host name=connectionpooling appBase=webapps/ConnectionPooling Context path= docBase=C:/dev/projects/ConnectionPooling reloadable=true debug=true Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/ /Context /Host -Rashmi - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
Also what does your JDBC code look like? (Please post small relevant snippets) - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
I tried it both ways. Once my resource wasn't defined globally at all, but it was defined under the Context. Next, my resource was defined only globally and not under the context. Is that the problem? Should it be global and under the context? I'm using the test.jsp file and the standard-taglibs.jar file that are suggested in the same tutorial that you linked. Thanks, --Melih On 4/2/07, Rashmi Rubdi [EMAIL PROTECTED] wrote: Also what does your JDBC code look like? (Please post small relevant snippets) - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
If you try the example exactly without any variations, it should work. It worked for me. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JNDI Datasource Problem
many thanks, it works beautifully now. what i did 1. META-INF/context.xml ?xml version=1.0 encoding=UTF-8? Context debug=0 displayName=gallery docBase=gallery path=/gallery reloadable=true Logger className=org.apache.catalina.logger.FileLogger prefix=Gallery. suffix=.log timestamp=true/ !-- Define a database connection pool for MYSQL -- Resource auth=Container name=jdbc/galleryDB type=javax.sql.DataSource driverClassName=org.gjt.mm.mysql.Driver url=jdbc:mysql://localhost/jidienadmin?autoReconnect=true username=ada password=erer maxActive=50 maxIdle=10 maxWait=1 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true/ /Context 2. in WEB-INF/web.xml web-app ... resource-ref res-ref-namejdbc/galleryDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref ... /web-app 3 remove the portion from server.xml (as we don't need it,application specific context.xml works) 4 remove the resourcelink from ..\conf\Catalina\localhost\...xml From: Wang, Hansen [EMAIL PROTECTED] Reply-To: Tomcat Users List users@tomcat.apache.org To: Tomcat Users List users@tomcat.apache.org Subject: RE: JNDI Datasource Problem Date: Mon, 27 Feb 2006 11:00:40 -0700 Two problems: 1. In ResourceLink, the value for attribute golbal should be jdbc/galleryDB instead of galleryDB. 2. The factory classname is wrong if you are using tomcat5's naming-factory-dbcp.jar. You can just remove that line and the default is used. -Original Message- From: lee hwaying [mailto:[EMAIL PROTECTED] Sent: Friday, February 24, 2006 3:22 PM To: users@tomcat.apache.org Subject: JNDI Datasource Problem ERROR JDBCExceptionReporter - Cannot create JDBC driver of class '' for connect URL 'null' I still get the above error in Tomcat 5.5.15 after doing the below. Please help web.xml : ... resource-ref res-ref-namejdbc/galleryDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref ... C:\apache-tomcat-5.5.15\conf\server.xml : ... !-- Global JNDI resources -- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / Resource auth=Container name=jdbc/galleryDB type= javax.sql.DataSource factory=org.apache.commons.dbcp.BasicDataSourceFactory driverClassName=org.gjt.mm.mysql.Driver url=jdbc:mysql://localhost/Gallery?autoReconnect=true username=GalleryUser password=hwaying maxActive=50 maxIdle=10 maxWait=1 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true/ /GlobalNamingResources ... C:\apache-tomcat-5.5.15\conf\Catalina\localhost\root.xml Context debug=0 displayName=gallery path=/gallery docbase=C:\apache- tomcat-5.5.15\webapps\gallery reloadable=true !-- Link to the user database we will get roles from -- ResourceLink name=jdbc/galleryDB global=galleryDB type=javax.sql.DataSource/ /Context Please help many thansk _ Find love online with MSN Personals. http://match.msn.com.my/match/mt.cfm?pg=channel - 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] _ Find love online with MSN Personals. http://match.msn.com.my/match/mt.cfm?pg=channel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
may i know how to use connetor/J? From: umesh balasubramaniam [EMAIL PROTECTED] Reply-To: Tomcat Users List users@tomcat.apache.org To: Tomcat Users List users@tomcat.apache.org Subject: Re: JNDI Datasource Problem Date: Fri, 24 Feb 2006 21:55:15 -0800 Try using connector/J and the configuration below: Resource name=jdbc/galleryDB auth=Container type= javax.sql.DataSource/ ResourceParams name=jdbc/galleryDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory /value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost/Gallery?autoReconnect=true/value /parameter parameter nameusername/name valueGalleryUser/value /parameter parameter namepassword/name valuehwaying/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /Context On 2/24/06, lee hwaying [EMAIL PROTECTED] wrote: ERROR JDBCExceptionReporter - Cannot create JDBC driver of class '' for connect URL 'null' I still get the above error in Tomcat 5.5.15 after doing the below. Please help web.xml : ... resource-ref res-ref-namejdbc/galleryDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref ... C:\apache-tomcat-5.5.15\conf\server.xml : ... !-- Global JNDI resources -- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / Resource auth=Container name=jdbc/galleryDB type= javax.sql.DataSource factory=org.apache.commons.dbcp.BasicDataSourceFactory driverClassName=org.gjt.mm.mysql.Driver url=jdbc:mysql://localhost/Gallery?autoReconnect=true username=GalleryUser password=hwaying maxActive=50 maxIdle=10 maxWait=1 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true/ /GlobalNamingResources ... C:\apache-tomcat-5.5.15\conf\Catalina\localhost\root.xml Context debug=0 displayName=gallery path=/gallery docbase=C:\apache- tomcat-5.5.15\webapps\gallery reloadable=true !-- Link to the user database we will get roles from -- ResourceLink name=jdbc/galleryDB global=galleryDB type=javax.sql.DataSource/ /Context Please help many thansk _ Find love online with MSN Personals. http://match.msn.com.my/match/mt.cfm?pg=channel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Find love online with MSN Personals. http://match.msn.com.my/match/mt.cfm?pg=channel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JNDI Datasource Problem
From: umesh balasubramaniam [mailto:[EMAIL PROTECTED] Subject: Re: JNDI Datasource Problem Try using connector/J and the configuration below: Resource name=jdbc/galleryDB auth=Container type= javax.sql.DataSource/ ResourceParams name=jdbc/galleryDB No idea what connector/J is, but the question specifically pertained to Tomcat 5.5, and there is no ResourceParams tag in that version: http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.h tml - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
Just to add my 2 cents. I have found the only thing that consistently worked for me is to declare the Realm and the Datasource inside of META-INF/context.xml if you deploy war files, $TOMCAT_HOME/conf/Catalina/host/MyContext.xml if you don't. Then reference the datasource as normal in your web.xml Good luck, Vinny Ghetto Java: http://www.xaymaca.com/roller/page/gj On 2/25/06, umesh balasubramaniam [EMAIL PROTECTED] wrote: Connector/J is the newer mysql driver. http://www.mysql.com/products/connector/j/ Umesh On 2/25/06, Caldarale, Charles R [EMAIL PROTECTED] wrote: From: umesh balasubramaniam [mailto:[EMAIL PROTECTED] Subject: Re: JNDI Datasource Problem Try using connector/J and the configuration below: Resource name=jdbc/galleryDB auth=Container type= javax.sql.DataSource/ ResourceParams name=jdbc/galleryDB No idea what connector/J is, but the question specifically pertained to Tomcat 5.5, and there is no ResourceParams tag in that version: http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.h tml - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ghetto Java: http://www.xaymaca.com/roller/page/gj - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JNDI Datasource Problem
ERROR JDBCExceptionReporter - Cannot create JDBC driver of class '' for connect URL 'null' I still get the above error in Tomcat 5.5.15 after doing the below. Please help web.xml : ... resource-ref res-ref-namejdbc/galleryDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref ... C:\apache-tomcat-5.5.15\conf\server.xml : ... !-- Global JNDI resources -- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / Resource auth=Container name=jdbc/galleryDB type= javax.sql.DataSource factory=org.apache.commons.dbcp.BasicDataSourceFactory driverClassName=org.gjt.mm.mysql.Driver url=jdbc:mysql://localhost/Gallery?autoReconnect=true username=GalleryUser password=hwaying maxActive=50 maxIdle=10 maxWait=1 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true/ /GlobalNamingResources ... C:\apache-tomcat-5.5.15\conf\Catalina\localhost\root.xml Context debug=0 displayName=gallery path=/gallery docbase=C:\apache- tomcat-5.5.15\webapps\gallery reloadable=true !-- Link to the user database we will get roles from -- ResourceLink name=jdbc/galleryDB global=galleryDB type=javax.sql.DataSource/ /Context Please help many thansk _ Find love online with MSN Personals. http://match.msn.com.my/match/mt.cfm?pg=channel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
Try using connector/J and the configuration below: Resource name=jdbc/galleryDB auth=Container type= javax.sql.DataSource/ ResourceParams name=jdbc/galleryDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory /value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost/Gallery?autoReconnect=true/value /parameter parameter nameusername/name valueGalleryUser/value /parameter parameter namepassword/name valuehwaying/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /Context On 2/24/06, lee hwaying [EMAIL PROTECTED] wrote: ERROR JDBCExceptionReporter - Cannot create JDBC driver of class '' for connect URL 'null' I still get the above error in Tomcat 5.5.15 after doing the below. Please help web.xml : ... resource-ref res-ref-namejdbc/galleryDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref ... C:\apache-tomcat-5.5.15\conf\server.xml : ... !-- Global JNDI resources -- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / Resource auth=Container name=jdbc/galleryDB type= javax.sql.DataSource factory=org.apache.commons.dbcp.BasicDataSourceFactory driverClassName=org.gjt.mm.mysql.Driver url=jdbc:mysql://localhost/Gallery?autoReconnect=true username=GalleryUser password=hwaying maxActive=50 maxIdle=10 maxWait=1 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true/ /GlobalNamingResources ... C:\apache-tomcat-5.5.15\conf\Catalina\localhost\root.xml Context debug=0 displayName=gallery path=/gallery docbase=C:\apache- tomcat-5.5.15\webapps\gallery reloadable=true !-- Link to the user database we will get roles from -- ResourceLink name=jdbc/galleryDB global=galleryDB type=javax.sql.DataSource/ /Context Please help many thansk _ Find love online with MSN Personals. http://match.msn.com.my/match/mt.cfm?pg=channel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
i think you would need to change the context.xml? On 2/20/06, Mark Whitby [EMAIL PROTECTED] wrote: Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file ( mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- parameter nameurl/name valuejdbc:mysql://localhost:3306/fyptest?autoReconnect=true/value /parameter /ResourceParams /Context web.xml file: resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref
RE: JNDI Datasource Problem
What release of Tomcat are you using? If it is 5.5.x, you can not alter the Server.xml file. You will need to create a context file and place it into your META_INF directory in your application. Tomcat will place it into your CATALINA_HOME\conf\Catalina\localhost directory when the application is started. -Original Message- From: chuanjiang lo [mailto:[EMAIL PROTECTED] Sent: Monday, February 20, 2006 7:25 AM To: Tomcat Users List Subject: Re: JNDI Datasource Problem i think you would need to change the context.xml? On 2/20/06, Mark Whitby [EMAIL PROTECTED] wrote: Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file ( mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- parameter nameurl/name valuejdbc:mysql://localhost:3306/fyptest?autoReconnect=true/value /parameter /ResourceParams /Context web.xml file: resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the From: field. - To unsubscribe, e-mail: [EMAIL PROTECTED
Re: JNDI Datasource Problem
Yeah it's 5.5.15. It's strange that because I'm advised to actually change the server.xml file in the guide to setting up a JNDI Source on the Tomcat website. My server.xl file is in a bit of a state though so I've attached it to this email see if I've set it up right as it says here: http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html Mark - Original Message - From: Rose, Greg [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Monday, February 20, 2006 12:33 PM Subject: RE: JNDI Datasource Problem What release of Tomcat are you using? If it is 5.5.x, you can not alter the Server.xml file. You will need to create a context file and place it into your META_INF directory in your application. Tomcat will place it into your CATALINA_HOME\conf\Catalina\localhost directory when the application is started. -Original Message- From: chuanjiang lo [mailto:[EMAIL PROTECTED] Sent: Monday, February 20, 2006 7:25 AM To: Tomcat Users List Subject: Re: JNDI Datasource Problem i think you would need to change the context.xml? On 2/20/06, Mark Whitby [EMAIL PROTECTED] wrote: Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file ( mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- parameter nameurl/name valuejdbc:mysql://localhost:3306/fyptest?autoReconnect=true/value /parameter /ResourceParams /Context web.xml file: resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information
RE: JNDI Datasource Problem
From: Rose, Greg [mailto:[EMAIL PROTECTED] Subject: RE: JNDI Datasource Problem If it is 5.5.x, you can not alter the Server.xml file. That's not correct. It is strongly recommended to put Context tags in either the META-INF directory of the webapp or in conf/Catalina/[hostname]/[appname].xml, but Context settings inside conf/server.xml are still permitted and honored. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JNDI Datasource Problem
If you look at the resulting link when you click on CONTEXT http://tomcat.apache.org/tomcat-5.5-doc/config/context.html It gives you several options as to setting up your context. They all refer to the context.xml file, not the Server.xml file. I have found that placing my context.xml file into my application's META-INF directory works for me. That is the last option given in the help. -Original Message- From: Mark Whitby [mailto:[EMAIL PROTECTED] Sent: Monday, February 20, 2006 7:37 AM To: Tomcat Users List Subject: Re: JNDI Datasource Problem Yeah it's 5.5.15. It's strange that because I'm advised to actually change the server.xml file in the guide to setting up a JNDI Source on the Tomcat website. My server.xl file is in a bit of a state though so I've attached it to this email see if I've set it up right as it says here: http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.h tml Mark - Original Message - From: Rose, Greg [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Monday, February 20, 2006 12:33 PM Subject: RE: JNDI Datasource Problem What release of Tomcat are you using? If it is 5.5.x, you can not alter the Server.xml file. You will need to create a context file and place it into your META_INF directory in your application. Tomcat will place it into your CATALINA_HOME\conf\Catalina\localhost directory when the application is started. -Original Message- From: chuanjiang lo [mailto:[EMAIL PROTECTED] Sent: Monday, February 20, 2006 7:25 AM To: Tomcat Users List Subject: Re: JNDI Datasource Problem i think you would need to change the context.xml? On 2/20/06, Mark Whitby [EMAIL PROTECTED] wrote: Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file ( mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect
RE: JNDI Datasource Problem
Sorry, I must be confused then, since the help page says: Please note that for tomcat 5, unlike tomcat 4.x, it is NOT recommended to place Context elements directly in the server.xml file. Instead, put them in the META-INF/context.xml directory of your WAR file or the conf directory as described above. I need to have my application change without restarting Tomcat, so that may be the difference. Chuck has helped me in the past and seems to be an expert with Tomcat, so follow his advice. -Original Message- From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] Sent: Monday, February 20, 2006 7:43 AM To: Tomcat Users List Subject: RE: JNDI Datasource Problem From: Rose, Greg [mailto:[EMAIL PROTECTED] Subject: RE: JNDI Datasource Problem If it is 5.5.x, you can not alter the Server.xml file. That's not correct. It is strongly recommended to put Context tags in either the META-INF directory of the webapp or in conf/Catalina/[hostname]/[appname].xml, but Context settings inside conf/server.xml are still permitted and honored. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the From: field. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
Rose, Greg wrote: If you look at the resulting link when you click on CONTEXT http://tomcat.apache.org/tomcat-5.5-doc/config/context.html It gives you several options as to setting up your context. They all refer to the context.xml file, not the Server.xml file. I have found that placing my context.xml file into my application's META-INF directory works for me. That is the last option given in the help. All very good. But that doesn't change the fact that Chuck is right when he's saying that you're wrong. Putting Contexts in server.xml is discouraged for Tomcat 5.x - but it is still possible. Regards mks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
I didn't see any mention of the Tomcat version here, but in 5.5 the ResourceParams part of the config is no longer used. All paramters go in the Resource ... tag with name=value format just like name and auth from your example below. i.e. maxIdle=30. -marc --- Mark Whitby [EMAIL PROTECTED] wrote: Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- parameter nameurl/name valuejdbc:mysql://localhost:3306/fyptest?autoReconnect=true/value /parameter /ResourceParams /Context web.xml file: resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
directory=logs prefix=localhost_access_log. suffix=.txt pattern=common resolveHosts=false/ -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true !-- maxActive: Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- !-- maxIdle: Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- !-- maxWait: Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- !-- username and password: MySQL dB username and password for dB connections -- !-- driverClassName: Class name for the old mm.mysql JDBC driver is org.gjt.mm.mysql.Driver - we recommend using Connector/J though. Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver. -- !-- url: The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=pilks2 driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fyptest?autoReconnect=true/ /Context /Host /Engine /Service /Server - Original Message - From: Marc Richards [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Monday, February 20, 2006 8:55 PM Subject: Re: JNDI Datasource Problem I didn't see any mention of the Tomcat version here, but in 5.5 the ResourceParams part of the config is no longer used. All paramters go in the Resource ... tag with name=value format just like name and auth from your example below. i.e. maxIdle=30. -marc --- Mark Whitby [EMAIL PROTECTED] wrote: Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name
Re: JNDI Datasource Problem
, and then have that user identity maintained across *all* web applications contained in this virtual host. -- !-- Valve className=org.apache.catalina.authenticator.SingleSignOn / -- !-- Access log processes all requests for this virtual host. By default, log files are created in the logs directory relative to $CATALINA_HOME. If you wish, you can specify a different directory with the directory attribute. Specify either a relative (to $CATALINA_HOME) or absolute path to the desired directory. -- !-- Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=localhost_access_log. suffix=.txt pattern=common resolveHosts=false/ -- !-- Access log processes all requests for this virtual host. By default, log files are created in the logs directory relative to $CATALINA_HOME. If you wish, you can specify a different directory with the directory attribute. Specify either a relative (to $CATALINA_HOME) or absolute path to the desired directory. This access log implementation is optimized for maximum performance, but is hardcoded to support only the common and combined patterns. -- !-- Valve className=org.apache.catalina.valves.FastCommonAccessLogValve directory=logs prefix=localhost_access_log. suffix=.txt pattern=common resolveHosts=false/ -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true !-- maxActive: Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- !-- maxIdle: Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- !-- maxWait: Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- !-- username and password: MySQL dB username and password for dB connections -- !-- driverClassName: Class name for the old mm.mysql JDBC driver is org.gjt.mm.mysql.Driver - we recommend using Connector/J though. Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver. -- !-- url: The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=pilks2 driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fyptest?autoReconnect=true/ /Context /Host /Engine /Service /Server - Original Message - From: Marc Richards [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Monday, February 20, 2006 8:55 PM Subject: Re: JNDI Datasource Problem I didn't see any mention of the Tomcat version here, but in 5.5 the ResourceParams part of the config is no longer used. All paramters go in the Resource ... tag with name=value format just like name and auth from your example below. i.e. maxIdle=30. -marc --- Mark Whitby [EMAIL PROTECTED] wrote: Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I
JNDI Datasource Problem
Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- parameter nameurl/name valuejdbc:mysql://localhost:3306/fyptest?autoReconnect=true/value /parameter /ResourceParams /Context web.xml file: resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref
Re: JNDI Datasource Problem
Look up resource link. It goes in the context.xml Also only put the jar file in the common/lib and no where else. - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 12:53 PM Subject: JNDI Datasource Problem Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- parameter nameurl/name valuejdbc:mysql://localhost:3306/fyptest?autoReconnect=true/value /parameter /ResourceParams /Context web.xml file: resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI Datasource Problem
I've done that and I now get the following error: org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: java.sql.SQLException: No suitable driver This is what I have in my context.xml file: !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource !-- Uncomment this to disable session persistence across Tomcat restarts -- !-- Manager pathname= / -- ResourceLink name=jdbc/TestDB global=jdbc/TestDB type=javax.sql.DataSource auth=Container / /Context Any further suggestions? Mark - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 7:02 PM Subject: Re: JNDI Datasource Problem Look up resource link. It goes in the context.xml Also only put the jar file in the common/lib and no where else. - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 12:53 PM Subject: JNDI Datasource Problem Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- parameter nameurl/name valuejdbc:mysql://localhost:3306/fyptest?autoReconnect=true/value /parameter /ResourceParams /Context web.xml file: resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: JNDI Datasource Problem
Since you have WatchedResources /, this suggests you are using some version of 5.5. In this case, the ResourceParams / is ignored (you set them as attributes on the Resource / tag). Mark Whitby [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've done that and I now get the following error: org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: java.sql.SQLException: No suitable driver This is what I have in my context.xml file: !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource !-- Uncomment this to disable session persistence across Tomcat restarts -- !-- Manager pathname= / -- ResourceLink name=jdbc/TestDB global=jdbc/TestDB type=javax.sql.DataSource auth=Container / /Context Any further suggestions? Mark - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 7:02 PM Subject: Re: JNDI Datasource Problem Look up resource link. It goes in the context.xml Also only put the jar file in the common/lib and no where else. - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 12:53 PM Subject: JNDI Datasource Problem Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- parameter nameurl/name valuejdbc:mysql://localhost:3306/fyptest?autoReconnect=true/value /parameter /ResourceParams /Context web.xml file
Re: JNDI Datasource Problem
Yes I'm using version 5.5.15. What I have in the server.xml file is what is advised in the Tomcat set up pages. So would it make any difference removing one of these or as it's ignored does it not matter? Mark - Original Message - From: Bill Barker [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Sunday, February 19, 2006 8:40 PM Subject: Re: JNDI Datasource Problem Since you have WatchedResources /, this suggests you are using some version of 5.5. In this case, the ResourceParams / is ignored (you set them as attributes on the Resource / tag). Mark Whitby [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've done that and I now get the following error: org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: java.sql.SQLException: No suitable driver This is what I have in my context.xml file: !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource !-- Uncomment this to disable session persistence across Tomcat restarts -- !-- Manager pathname= / -- ResourceLink name=jdbc/TestDB global=jdbc/TestDB type=javax.sql.DataSource auth=Container / /Context Any further suggestions? Mark - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 7:02 PM Subject: Re: JNDI Datasource Problem Look up resource link. It goes in the context.xml Also only put the jar file in the common/lib and no where else. - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 12:53 PM Subject: JNDI Datasource Problem Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver
Re: JNDI Datasource Problem
There is no ResourceParams in 5.5. Check the documentation again, and make sure you're looking at the docs for 5.5 not 5.0. -- Len On 2/19/06, Mark Whitby [EMAIL PROTECTED] wrote: Yes I'm using version 5.5.15. What I have in the server.xml file is what is advised in the Tomcat set up pages. So would it make any difference removing one of these or as it's ignored does it not matter? Mark - Original Message - From: Bill Barker [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Sunday, February 19, 2006 8:40 PM Subject: Re: JNDI Datasource Problem Since you have WatchedResources /, this suggests you are using some version of 5.5. In this case, the ResourceParams / is ignored (you set them as attributes on the Resource / tag). Mark Whitby [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've done that and I now get the following error: org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: java.sql.SQLException: No suitable driver This is what I have in my context.xml file: !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource !-- Uncomment this to disable session persistence across Tomcat restarts -- !-- Manager pathname= / -- ResourceLink name=jdbc/TestDB global=jdbc/TestDB type=javax.sql.DataSource auth=Container / /Context Any further suggestions? Mark - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 7:02 PM Subject: Re: JNDI Datasource Problem Look up resource link. It goes in the context.xml Also only put the jar file in the common/lib and no where else. - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 12:53 PM Subject: JNDI Datasource Problem Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuepilks2/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name
Re: JNDI Datasource Problem
I've checked the documentation and yes I was reading the 5.0 version not the 5.5 one! However I've followed the new instructions and still get the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' The server.xml file now reads as follows: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=pilks2 driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fyptest?autoReconnect=true/ /Context Any ideas what's wrong now? Mark - Original Message - From: Len Popp [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 9:22 PM Subject: Re: JNDI Datasource Problem There is no ResourceParams in 5.5. Check the documentation again, and make sure you're looking at the docs for 5.5 not 5.0. -- Len On 2/19/06, Mark Whitby [EMAIL PROTECTED] wrote: Yes I'm using version 5.5.15. What I have in the server.xml file is what is advised in the Tomcat set up pages. So would it make any difference removing one of these or as it's ignored does it not matter? Mark - Original Message - From: Bill Barker [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Sunday, February 19, 2006 8:40 PM Subject: Re: JNDI Datasource Problem Since you have WatchedResources /, this suggests you are using some version of 5.5. In this case, the ResourceParams / is ignored (you set them as attributes on the Resource / tag). Mark Whitby [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've done that and I now get the following error: org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: java.sql.SQLException: No suitable driver This is what I have in my context.xml file: !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource !-- Uncomment this to disable session persistence across Tomcat restarts -- !-- Manager pathname= / -- ResourceLink name=jdbc/TestDB global=jdbc/TestDB type=javax.sql.DataSource auth=Container / /Context Any further suggestions? Mark - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 7:02 PM Subject: Re: JNDI Datasource Problem Look up resource link. It goes in the context.xml Also only put the jar file in the common/lib and no where else. - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 12:53 PM Subject: JNDI Datasource Problem Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation
Re: JNDI Datasource Problem
EDIT: I've just realised that my server.xml file may not be correctly set up so I've attached it to this email incase that is the case. I did change it using the Tomcat Admin and it seems to have messed up my formatting so I can't tell if the context and host tags are correct. Mark - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 9:34 PM Subject: Re: JNDI Datasource Problem I've checked the documentation and yes I was reading the 5.0 version not the 5.5 one! However I've followed the new instructions and still get the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' The server.xml file now reads as follows: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=pilks2 driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fyptest?autoReconnect=true/ /Context Any ideas what's wrong now? Mark - Original Message - From: Len Popp [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 9:22 PM Subject: Re: JNDI Datasource Problem There is no ResourceParams in 5.5. Check the documentation again, and make sure you're looking at the docs for 5.5 not 5.0. -- Len On 2/19/06, Mark Whitby [EMAIL PROTECTED] wrote: Yes I'm using version 5.5.15. What I have in the server.xml file is what is advised in the Tomcat set up pages. So would it make any difference removing one of these or as it's ignored does it not matter? Mark - Original Message - From: Bill Barker [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Sunday, February 19, 2006 8:40 PM Subject: Re: JNDI Datasource Problem Since you have WatchedResources /, this suggests you are using some version of 5.5. In this case, the ResourceParams / is ignored (you set them as attributes on the Resource / tag). Mark Whitby [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've done that and I now get the following error: org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: java.sql.SQLException: No suitable driver This is what I have in my context.xml file: !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource !-- Uncomment this to disable session persistence across Tomcat restarts -- !-- Manager pathname= / -- ResourceLink name=jdbc/TestDB global=jdbc/TestDB type=javax.sql.DataSource auth=Container / /Context Any further suggestions? Mark - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 7:02 PM Subject: Re: JNDI Datasource Problem Look up resource link. It goes in the context.xml Also only put the jar file in the common/lib and no where else. - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 12:53 PM Subject: JNDI Datasource Problem Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file as stated, placed the relevent jar file (mysql-connector-java-3.1.12-bin.jar) in the lib folder in my web application and in the /common/lib folder in the Tomcat home folder and I've reset the server and I'm still getting the same problem. I'm using MySQL, database is called 'fyptest' and the table is called 'testdata'. So where am I going wrong? Many thanks Mark Whitby Server.xml file: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB parameter namefactory/name
Re: JNDI Datasource Problem
your connection string doesn't quite look right the following is what I use. jdbc:mysql://box.domain.com:3306/dbname?user=whoeverpassword=whatever The problem that is usually associated with the error message you get invalid: java.sql.SQLException: No suitable driver usually implies that there is something wrong with the url of the connection. I had this happen a few times. Once for leaving out the second collin jdbc:mysql // It was defined in properties file so it was easy to fix, but anyway..there have been other times I got that error and it was the same reasonbadly formed url hence the mismatch on the drivers listed in the jar. I also give it the full hostname in the url. Though localhost should resolve, it can greatly depend on DNS and host files, etc. Have been thru that too. Mark Whitby wrote: EDIT: I've just realised that my server.xml file may not be correctly set up so I've attached it to this email incase that is the case. I did change it using the Tomcat Admin and it seems to have messed up my formatting so I can't tell if the context and host tags are correct. Mark - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 9:34 PM Subject: Re: JNDI Datasource Problem I've checked the documentation and yes I was reading the 5.0 version not the 5.5 one! However I've followed the new instructions and still get the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' The server.xml file now reads as follows: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=pilks2 driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fyptest?autoReconnect=true/ /Context Any ideas what's wrong now? Mark - Original Message - From: Len Popp [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 9:22 PM Subject: Re: JNDI Datasource Problem There is no ResourceParams in 5.5. Check the documentation again, and make sure you're looking at the docs for 5.5 not 5.0. -- Len On 2/19/06, Mark Whitby [EMAIL PROTECTED] wrote: Yes I'm using version 5.5.15. What I have in the server.xml file is what is advised in the Tomcat set up pages. So would it make any difference removing one of these or as it's ignored does it not matter? Mark - Original Message - From: Bill Barker [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Sunday, February 19, 2006 8:40 PM Subject: Re: JNDI Datasource Problem Since you have WatchedResources /, this suggests you are using some version of 5.5. In this case, the ResourceParams / is ignored (you set them as attributes on the Resource / tag). Mark Whitby [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've done that and I now get the following error: org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: java.sql.SQLException: No suitable driver This is what I have in my context.xml file: !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource !-- Uncomment this to disable session persistence across Tomcat restarts -- !-- Manager pathname= / -- ResourceLink name=jdbc/TestDB global=jdbc/TestDB type=javax.sql.DataSource auth=Container / /Context Any further suggestions? Mark - Original Message - From: Parsons Technical Services [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 7:02 PM Subject: Re: JNDI Datasource Problem Look up resource link. It goes in the context.xml Also only put the jar file in the common/lib and no where else. - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, February 19, 2006 12:53 PM Subject: JNDI Datasource Problem Hey guys, Thanks for the help with the previous problem I had, I've managed to solve them now thanks to your help. But now I'm having a problem with setting up a DataSource connection. I've followed the example word for word and got the following error: javax.servlet.ServletException: Unable to get connection, DataSource invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I did a google search for this but only managed to find something on the NetBeans website which wasn't much help. I've edited the server.xml file