Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 73441 invoked from network); 29 Aug 2002 21:14:14 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 29 Aug 2002 21:14:14 -0000 Received: (qmail 27540 invoked by uid 97); 29 Aug 2002 21:13:50 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 27517 invoked by uid 97); 29 Aug 2002 21:13:50 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 27504 invoked by uid 98); 29 Aug 2002 21:13:49 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <000c01c24fa0$dff9d8d0$5da05f18@Ceres> From: "Vance Christiaanse" To: "Tomcat Users List" Subject: Tomcat 4.0 DataSources Date: Thu, 29 Aug 2002 17:13:06 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Tomcat fans, Here is some experimental data on trying to configure a DataSource with Tomcat 4.0.4. I don't have it working yet but have drawn the following conclusions: (A) Putting the driver zip file on the catalina class path seems to make no difference (B) Putting the driver zip file renamed to be a jar file in common\lib seems to produce UnsatisfiedLinkError (C) Putting the jar file in lib at least allows the DataSource to be created Hope this helps somebody! Vance ======================================================================== CONFIGURATION RESULT zip on jar in jar in Can create Can get Catalina %CATALINA% %CATALINA% DataSource connection classpath common\lib lib NO NO NO NO [Error (1) N/A driver class] YES NO NO NO [Error (1) N/A driver class] NO YES NO NO [Error (2) N/A UnsatisfiedLinkError] YES YES NO NO [Error (2) N/A UnsatisfiedLinkError] NO YES YES NO [Error (2) N/A UnsatisfiedLinkError] NO NO YES YES!!!! NO [Error (3) driver class] YES NO YES YES!!!! NO [Error (3) driver class] (1) javax.naming.NamingException: Exception creating DataSource: COM.ibm.db2.jdbc.app.DB2Driver (2) javax.naming.NamingException: Exception creating DataSource: java.lang.UnsatisfiedLinkError: no db2jdbc in java.library.path (3) DataSource: Failed to load JDBC driver: COM/ibm/db2/jdbc/app/DB2Driver DataSource: Failed to initialize JDBC driver: java.sql.SQLException: No suitable driver java.sql.SQLException: No suitable driver ----- Original Message ----- From: To: "Tomcat Users List" Sent: Thursday, August 29, 2002 2:03 PM Subject: Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL > > Vance, > > Good eye. It use to be driverName but got changed along the way to URL. > Probably when I started following the 4.1 how-to. In any case, I changed > back to driverName and, alas, same problem. > > Vance, do you get the same error? > > javax.naming.NamingException: Exception creating DataSource: > org.hsql.jdbcDriver > at org.apache.naming.NamingContext.lookup(NamingContext.java:842) > at org.apache.naming.NamingContext.lookup(NamingContext.java:181) > at org.apache.naming.NamingContext.lookup(NamingContext.java:822) > at org.apache.naming.NamingContext.lookup(NamingContext.java:194) > at foo.DBTest1.init(DBTest1.java:20) > at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60) > > > > > > "Vance > Christiaanse" > com> "Tomcat Users List" > > 08/29/2002 11:16 cc > AM > Subject > Re: Trouble configuring Tomcat 4.0.4 > Please respond to JNDI connection to MySQL > "Tomcat Users > List" > ta.apache.org> > > > > > > > Steve, > > I'm stuck in a similar situation. Here's one thing I noticed about your > server.xml file: > > The 4.1 JNDI How-to uses a parameter name of "url" for the URL but the 4.0 > JNDI How-to uses a parameter name of "driverName" for the URL. > > Your server.xml file is using "url" for the parameter name but you're > trying > to use 4.0. > > I don't know if this is significant or not. > > Vance > > ----- Original Message ----- > From: > To: "Tomcat Users List" > Sent: Thursday, August 29, 2002 10:31 AM > Subject: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL > > > > After reading something in another post this morning I realized I was > > mixing instructions from the 4.1 JNDI How-to. I've reposted this message > > with updated information after making sure I was ONLY following the 4.0 > > JNDI How to. > > > > I have deleted my server.xml and started with a fresh copy. First, I > made > > sure I could connect to MySQL with a regular JDBC connection. Next, I > > added a JDBC Realm using MySQL. That works fine. Finally, I added a > JDBC > > resource and tried to use it. That is when I get the error below. > > > > The error I have, and have always had, even before the 4.1 detour, is the > > following: > > > > javax.naming.NamingException: Exception creating DataSource: > > org.hsql.jdbcDriver > > at org.apache.naming.NamingContext.lookup(NamingContext.java:842) > > at org.apache.naming.NamingContext.lookup(NamingContext.java:181) > > at org.apache.naming.NamingContext.lookup(NamingContext.java:822) > > at org.apache.naming.NamingContext.lookup(NamingContext.java:181) > > at org.apache.naming.NamingContext.lookup(NamingContext.java:822) > > at org.apache.naming.NamingContext.lookup(NamingContext.java:181) > > at org.apache.naming.NamingContext.lookup(NamingContext.java:822) > > at org.apache.naming.NamingContext.lookup(NamingContext.java:194) > > at > org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) > > at javax.naming.InitialContext.lookup(InitialContext.java:351) > > at foo.DBTest1.init(DBTest1.java:19) > > at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60) > > > > Why would Tomcat be looking for a Hypersonic SQL driver? I took a shot > and > > copied Hypersonic 1.61 hsqldb.jar to /common/lib, but when it had no > effect > > I removed it. > > > > I'm currently running > > Windows 2000 > > J2SE 1.4.0 > > J2SE 1.3.1 > > Tomcat 4.04 > > MySQL 4.0.2-Alpha > > MySQL Connector 2.0.14. (I copied mysql-connector-java-2.0.14-bin.jar to > > $TOMCAT_HOME/common/lib,) > > > > I get the same error no matter what code I run. For example, Both code > > blocks below result in the same error: > > Context ctx = new InitialContext(); > > ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY, > > "com.sun.jndi.fscontext.RefFSContextFactory"); > > Connection conn = ds.getConnection(); > > if(ctx == null ) > > throw new Exception("Boom - No Context"); > > DataSource ds = (DataSource)ctx.lookup( > > "java:comp/env/jdbc/TestDB"); <-- Blows up here > > --- AND --- > > Context initCtx = new InitialContext(); > > Context envCtx = (Context) initCtx.lookup("java:comp/env"); > > if(envCtx == null ) > > throw new Exception("Boom - No Context"); > > DataSource ds = > > (DataSource)envCtx.lookup("jdbc/TestDB"); <--- Blows up here > > > > I added the following to the web.xml file: > > > > DB Connection > > jdbc/TestDB > > javax.sql.DataSource > > Container > > > > > > Here is my server.xml file: > > > > > > > > > > className="org.apache.catalina.connector.http.HttpConnector" > > port="8080" minProcessors="5" maxProcessors="75" > > enableLookups="true" redirectPort="8443" > > acceptCount="10" debug="0" connectionTimeout="60000"/> > > > > > > > > > prefix="catalina_log." suffix=".txt" > > timestamp="true"/> > > > driverName="org.gjt.mm.mysql.Driver" > > connectionURL > > ="jdbc:mysql://localhost/authority?user=javauser;password=javadude" > > userTable="users" userNameCol="user_name" userCredCol > > ="user_pass" > > userRoleTable="user_roles" roleNameCol="role_name" /> > > > > unpackWARs="true"> > > > directory="logs" prefix="localhost_access_log." suffix > > =".txt" > > pattern="common"/> > > > directory="logs" prefix="localhost_log." suffix=".txt" > > timestamp="true"/> > > > > > > --> > > > > > > > debug="0" privileged="true"/> > > > > > > > reloadable="true" crossContext="true"> > > > prefix="localhost_examples_log." suffix=".txt" > > timestamp="true"/> > > > ="org.apache.catalina.session.PersistentManager" > > debug="0" > > saveOnRestart="true" > > maxActiveSessions="-1" > > minIdleSwap="-1" > > maxIdleSwap="-1" > > maxIdleBackup="-1"> > > ="org.apache.catalina.session.FileStore"/> > > > > > > > > > debug="5" reloadable="true" crossContext="true"> > > > > > prefix="localhost_DBTest_log." suffix=".txt" > > timestamp="true"/> > > > > > auth="Container" > > type="javax.sql.DataSource"/> > > > > > > factory > > > > org.apache.commons.dbcp.BasicDataSourceFactory > > > > > > maxActive > > 100 > > > > > > maxIdle > > 30000 > > > > > > maxWait > > 100 > > > > > > username > > javauser > > > > > > password > > javadude > > > > > > > > driverClassName > > org.gjt.mm.mysql.Driver > > > > > > > > url > > jdbc:mysql://localhost:3306/javatest > > > > > > > > > > > > > > > > > > > > > > > > > > className="org.apache.catalina.connector.warp.WarpConnector" > > port="8008" minProcessors="5" maxProcessors="75" > > enableLookups="true" > > acceptCount="10" debug="0"/> > > > > > > > name="Apache" defaultHost="localhost" debug="0" appBase="webapps"> > > > > > > > prefix="apache_log." suffix=".txt" > > timestamp="true"/> > > > > > > > > > > > > > > > > > > > > > > Any ideas? > > > > Steve Mitchell > > e-Business Architect/Developer > > Integrated Corporate Solutions, Inc. > > 913-685-6506 > > stevem@teamics.com > > > > > > > > -- > > To unsubscribe, e-mail: > > > For additional commands, e-mail: > > > > > > > > -- > To unsubscribe, e-mail: < > mailto:tomcat-user-unsubscribe@jakarta.apache.org> > For additional commands, e-mail: < > mailto:tomcat-user-help@jakarta.apache.org> > > > > > > -- > To unsubscribe, e-mail: > For additional commands, e-mail: > -- To unsubscribe, e-mail: For additional commands, e-mail: