How about try to move your application ("wms") out of the webapps directory, let's say: c:\wms


Then in the server.xml, try to change docBase in the context:

docBase="c:\wms"

Now, see if your application works or give a different error.  Remember to drop the 
jdbc library into the common/lib folder.



Eric Wulff wrote:

Hi all, I'm returning to a problem I couldn't solve the first time,
about two months ago, and still can't seem to figure out.  I can't get
a db connection using connection pools.  I get the exception listed
below, same as so many have previously, but nothing I've found seems
to works.  Below are my specs.  Anyone with concrete advise/direction
on how to get
this working?

Also, I noticed in many solutions the suggestion was made to edit the
myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2
.xml's related to other applications and a manager.xml which I'm not
sure what it's related to.


OS: FC2
Tomcat 5.0.28

exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
JDBC driver class '' for connect URL 'null'

WEB-INF web xml: code inserted AFTER all servlet mappings...
        <resource-ref>
                <res-ref-name>jdbc/wms</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
        </resource-ref>

server xml(tried this with and without a Resource name)...
<Context path="/wms" docBase="wms" debug="0" reloadable="true">
   <ResourceParams name="jdbc/wms">
     <parameter>
       <name>username</name>
       <value>whatever</value>
     </parameter>
     <parameter>
       <name>password</name>
       <value>whatever</value>
     </parameter>
     <parameter>
       <name>driverClassName</name>
       <value>com.informix.jdbc.IfxDriver</value>
     </parameter>
          <parameter>
                <name>url</name>
        
<value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName</value>
        </parameter>
   </ResourceParams>
 </Context>

I have the following jars in my <CATALINA_HONE>/common/lib and I also
tried putting the db driver and commons-collections, dbcp, and pool in
my WEB-INF/lib with no success.  They are all mode 644.

ant.jar
ant-launcher.jar
commons-collections-3.1.jar
commons-dbcp-1.2.1.jar
commons-el.jar
commons-pool-1.2.jar
ifxjdbc.jar (the necessary informix driver)
jar.txt
jasper-compiler.jar
jasper-runtime.jar
jsp-api.jar
mysql-connector-java-3.0.15-ga-bin.jar
naming-common.jar
naming-factory.jar
naming-java.jar
naming-resources.jar
servlet-api.jar



On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
<[EMAIL PROTECTED]> wrote:


hi,
i am not sure but you may try downloading latest jar files for
following froom tomcat site and try them out. copy the old jar files
somewhere else and try using the latest jar files.
1) Commons Collections
2)Commons DBCP
3)Commons Pool




On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff <[EMAIL PROTECTED]> wrote:


Except that the driver works for connecting if I'm not utilizing a
connection pool, i.e., I am able to connect to the db and manipulate
data via DriverManager.getConnection(url, db, pwd).

The driver is located in CATALINA_HOME/commons/lib

Eric

On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
<[EMAIL PROTECTED]> wrote:


No, you don't need that many params. I think your problem might be the




driver. Where did you drop off your informix jdbc jar?


-----Original Message----- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling

Yes, I have added <Resource name=... >.  Now different errors are reported
via stack trace as I posted in response to Atishay's suggestion that I add
this.  I'll try adding your suggestions and see what happens.  Also, you
suggest adding many parameters.  Are they necessary for simply making a
connection?  If so, the tutorial I'm following, 'Tomcat Kick Start' left all
your suggestions out.
Including the <Resource> tag, but that seems critical for connection.

Eric

On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin <[EMAIL PROTECTED]>
wrote:


1. web.xml: OK

2. context.xml on <context> of server.xml:

       <Resource name="jdbc/test_connect" auth="Container"
type="javax.sql.DataSource"/> <= have you added this?
       <ResourceParams name="jdbc/test_connect">
       <parameter>
               <name>driverClassName</name>
               <value>your.jdbc.driver</value>
       </parameter>
       <parameter>
               <name>url</name>
               <value>your.jdbc.url</value>
       </parameter>
       <parameter>
               <name>username</name>
               <value>youruser</value>
       </parameter>
       <parameter>
               <name>password</name>
               <value>yourpass</value>
       </parameter>
       <parameter>
               <name>maxActive</name>
               <value>20</value>
       </parameter>
       <parameter>
               <name>maxIdle</name>
               <value>10</value>
       </parameter>
       <parameter>
               <name>minIdle</name>
               <value>10</value>
       </parameter>
       <parameter>
               <name>maxWait</name>
               <value>15000</value>
       </parameter>
       <parameter>
               <name>removeAbandoned</name>
               <value>true</value>
       </parameter>
       <parameter>
               <name>validationQuery</name>
               <value>your_query</value>
       </parameter>
       <parameter>
               <name>testOnBorrow</name>
               <value>true</value>
       </parameter>
       <parameter>
               <name>testOnReturn</name>
               <value>true</value>
       </parameter>
       <parameter>
               <name>minEvictableIdleTimeMillis</name>
               <value>-1</value>
       </parameter>
       <!-- sleeps 5 minutes -->
       <parameter>
               <name>timeBetweenEvictionRunsMillis</name>
               <value>300000</value>
       </parameter>
       <parameter>
               <name>numTestsPerEvictionRun</name>
               <value>1</value>
       </parameter>
       <parameter>
               <name>testWhileIdle</name>
               <value>true</value>
       </parameter>

       </ResourceParams>

3. code

               Context initContext = new InitialContext();
               Context jdbcContext = (Context)
initContext.lookup("java:comp/env");
               DataSource dataSource = (DataSource)
jdbcContext.lookup("jdbc/test_connect");
               ...


-----Original Message----- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 4:34 PM To: Tomcat Users List Subject: Re: connection pooling

Hi Phillip,

On Thu, 7 Oct 2004 09:29:09 -0400, you wrote:


Detail, detail, detail.

1. your context.xml
2. your web.xml
3. how do you obtain connection from pool, java code pls. 4. can you
connect using pool 5. commons-pool version

Etc. etc.

You need to provide details otherwise we can't help.


This was all included in my original post.  Ok, actually my 2nd post
because I accidentally hit send prior to completing my post via the
scroll pad on my laptop.  Still, thx for checking on this and the info
you looking for is copied again here...

System:
Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
Server 9.4 on Windows Server

-I am able to connect to my db via typical JDBC
DriverManager.getConnection().  This leads me to believe that my
informix jdbc driver is in the correct place...
CATALINA_HOME/common/lib -I have a Context set up in my server.xml per
examples in a text tutorial I'm referencing

Below listed...
-errors
-web.xml
-server.xml <Context> (minus connection actual values)
-.java

exception/errors:
-Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create
JDBC driver of class '' for connect URL 'null' SQL state: null Error
code: 0

-stack trace reveals this, but I can't see why since I have the driver
in the correct directory...
java.sql.SQLException: No suitable driver at
java.sql.DriverManager.getDriver(DriverManager.java:243) at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSour
ce.jav
a:773)

web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd";>
<web-app>
      <servlet>
              <servlet-name>Test Connection Pooling</servlet-name>
              <servlet-class>TestConnectionPooling</servlet-class>
      </servlet>

      <servlet-mapping>
              <servlet-name>Test Connection Pooling</servlet-name>
              <url-pattern>/testConnectionPooling</url-pattern>
      </servlet-mapping>

      <resource-ref>
        <res-ref-name>jdbc/test_connect</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
      </resource-ref>
</web-app>

server.xml <Context>:
<Context path="/testConnectionPooling"
docBase="testConnectionPooling" debug="0" reloadable="true">
<ResourceParams name="jdbc/test_connect">
<parameter>
<name>username</name>
<value>informix</value>
</parameter>
<parameter>
<name>password</name>
<value>informix</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.informix.jdbc.IfxDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
/value


    </parameter>
  </ResourceParams>
</Context>

.java:
import java.io.*;
import java.sql.*;
// -Must import javax.naming use JNDI which is required to implement data
//   resource references and hence connection pooling.
import javax.naming.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;

public class TestConnectionPooling extends HttpServlet {
      private DataSource dataSource;

public void init(ServletConfig config) throws ServletException {
try {
Context init = new InitialContext();
// don't know what the 'java:comp/env' refers to
Context ctx = (Context)


init.lookup("java:comp/env");


// I know "jdbc/conversion must match the
web.xml res-ref-name of the web.xml but don't know what the path really


refers to


                      dataSource = (DataSource)
ctx.lookup("jdbc/test_connect");
              } catch (NamingException ex) {
                      throw new ServletException("Cannot retrieve
java:comp/env/jdbc/test_connect",ex);
              }
      }

      public void doGet(HttpServletRequest request,
HttpServletResponse
response)
      throws ServletException, IOException {
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              Connection connection = null;
              out.println ("<HTML><HEAD><TITLE>Test Connection
Pooling</TITLE></HEAD><BODY>");
              out.println("<H1>Customer Name Query</H1>");

              try {
                      synchronized(dataSource) {
                          connection = dataSource.getConnection();
                      }
                      out.println("<br>");
                      out.println("<strong>Loaded informix driver
successfully via server.xml.</strong>" +
                                              "Now attempting db
connection.");
                      out.println("<br>");
                      PreparedStatement pstmt =
connection.prepareStatement("SELECT blah FROM blah blah");
                      ResultSet results = pstmt.executeQuery();
                      if (!results.next()) {
                              throw new SQLException("No data
returned for some reason");
                      }
                      out.println("<br>");
                      while(results.next()) {
                              out.println("<tr><td>" +
results.getString("blah") + "</td></tr>");
                      }
      } catch (Exception ex) {
                      out.println("<br>");
                      out.println("Exception: " + ex);
                      if(ex instanceof SQLException) {
                              SQLException sqlex = (SQLException) ex;
                              out.println("<br>");
                              out.println("SQL state:
"+sqlex.getSQLState()+"<BR>");
                              out.println("<br>");
                              out.println("Error code:
"+sqlex.getErrorCode()+"<BR>");
                              out.println("<br><br>");
                              sqlex.printStackTrace(out);
                              out.println("<br><br>");
                      }
      }
      finally {
          try { connection.close(); } catch (Exception ex) {}
      }
              out.println ("</BODY></HTML>");
  }
}

 ReplyForward

[EMAIL PROTECTED]
java code: Context ctx = (Context) init.lookup("xxxxxx"); server.xml:
<Resour...
                Oct 6 (22 hours ago)

[EMAIL PROTECTED]
Please ignore my last post - it's wrong. (Answered before verifying).
                Oct 6 (22 hours ago)

[EMAIL PROTECTED]
Is that litterally what you have in your server.xml?
                Oct 6 (22 hours ago)

Eric Wulff
No, literally I have the actual values. The same connection string I
use to s...
                Oct 6 (22 hours ago)

[EMAIL PROTECTED]
Is there a xxxxx.xml file in (TOMCAT_HOME)/conf/Catalina/localhost,
where xxx...
                Oct 6 (22 hours ago)

Eric Wulff
Context name? I assume your referring to the ResourceParams name
attribute, j...
                Oct 6 (19 hours ago)

Phillip Qin
<[EMAIL PROTECTED]> to Tomcat
        More options    6:29am (7 hours ago)
Detail, detail, detail.

1. your context.xml
2. your web.xml
3. how do you obtain connection from pool, java code pls.
4. can you connect using pool
5. commons-pool version

Etc. etc.

You need to provide details otherwise we can't help.
- Show quoted text -

-----Original Message-----
From: Eric Wulff [mailto:[EMAIL PROTECTED]
Sent: October 6, 2004 5:09 PM
To: [EMAIL PROTECTED]
Subject: connection pooling

Hi all, I have gone over some of the tomcat docs and googled errors
but there is SO much information covering JNDI and Datasources... and
I'm hoping I don't have to be a JNDI/Datasource and XML guru just to
set up db connections via connection pool.

My situation is this...

System:
Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
Server 9.4 on Windows Server

-I am able to connect to my db via typical JDBC
DriverManager.getConnection(). -This leads me to believe that my jdbc
driver is in the correct place ...CATALINA

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


ReplyForwardInvite Phillip to Gmail Send Save Draft Discard Check spelling To: Cc: Bcc:

Add Cc | Add Bcc | Edit Subject | Attach a file
Subject:

Attach a file

Send  Save Draft  Discard      Check spelling

Atishay Kumar
<[EMAIL PROTECTED]> to Tomcat, me
More options 6:47am (6 hours ago)
On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff <[EMAIL PROTECTED]>
wrote:


I have gone over some of the tomcat docs and googled errors but
there is SO much information covering JNDI, connection pooling, and
Datasources.  Can someone review the info below and consult or point
me in the right direction?  Although I feel I'm missing something
obvious, I can't find out what's wrong with my set-up.

thx
Eric

System:
Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
Server 9.4 on Windows Server

-I am able to connect to my db via typical JDBC
DriverManager.getConnection().  This leads me to believe that my
informix jdbc driver is in the correct place...
CATALINA_HOME/common/lib -I have a Context set up in my server.xml
per examples in a text tutorial I'm referencing

Below listed...
-errors
-web.xml
-server.xml <Context> (minus connection actual values) -.java

exception/errors:
-Exception: org.apache.commons.dbcp.SQLNestedException: Cannot
create JDBC driver of class '' for connect URL 'null' SQL state:
null Error code: 0

-stack trace reveals this, but I can't see why since I have the
driver in the correct directory...
java.sql.SQLException: No suitable driver at
java.sql.DriverManager.getDriver(DriverManager.java:243) at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSo
ur
ce.java:773)

web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd";>
<web-app>
       <servlet>
               <servlet-name>Test Connection Pooling</servlet-name>
               <servlet-class>TestConnectionPooling</servlet-class>
       </servlet>

       <servlet-mapping>
               <servlet-name>Test Connection Pooling</servlet-name>
               <url-pattern>/testConnectionPooling</url-pattern>
       </servlet-mapping>

       <resource-ref>
         <res-ref-name>jdbc/test_connect</res-ref-name>
         <res-type>javax.sql.DataSource</res-type>
         <res-auth>Container</res-auth>
       </resource-ref>
</web-app>

server.xml <Context>:
<Context path="/testConnectionPooling"
docBase="testConnectionPooling" debug="0" reloadable="true">


<Resource name="jdbc/test_connection" auth="Container"
type="javax.sql.DataSource"/> is missing



   <ResourceParams name="jdbc/test_connect">
     <parameter>
       <name>username</name>
       <value>informix</value>
     </parameter>
     <parameter>
       <name>password</name>
       <value>informix</value>
     </parameter>
     <parameter>
       <name>driverClassName</name>
       <value>com.informix.jdbc.IfxDriver</value>
     </parameter>
     <parameter>
       <name>url</name>



<value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
/value


     </parameter>
   </ResourceParams>
 </Context>

.java:
import java.io.*;
import java.sql.*;
// -Must import javax.naming use JNDI which is required to implement


data


//   resource references and hence connection pooling.
import javax.naming.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;

public class TestConnectionPooling extends HttpServlet {
       private DataSource dataSource;

public void init(ServletConfig config) throws ServletException {
try {
Context init = new InitialContext();
// don't know what the 'java:comp/env' refers to
Context ctx = (Context)


init.lookup("java:comp/env");


// I know "jdbc/conversion must match the
web.xml res-ref-name of the web.xml but don't know what the path
really


refers to


dataSource = (DataSource)


ctx.lookup("jdbc/test_connect");


               } catch (NamingException ex) {
                       throw new ServletException("Cannot retrieve
java:comp/env/jdbc/test_connect",ex);
               }
       }

public void doGet(HttpServletRequest request,
HttpServletResponse


response)


       throws ServletException, IOException {
               response.setContentType("text/html");
               PrintWriter out = response.getWriter();
               Connection connection = null;
               out.println ("<HTML><HEAD><TITLE>Test Connection
Pooling</TITLE></HEAD><BODY>");
               out.println("<H1>Customer Name Query</H1>");

try {
synchronized(dataSource) {
connection = dataSource.getConnection();
}
out.println("<br>");
out.println("<strong>Loaded informix driver
successfully via server.xml.</strong>" +
"Now attempting db


connection.");


out.println("<br>");
PreparedStatement pstmt =
connection.prepareStatement("SELECT blah FROM blah blah");
ResultSet results = pstmt.executeQuery();
if (!results.next()) {
throw new SQLException("No data
returned


for some reason");


}
out.println("<br>");
while(results.next()) {
out.println("<tr><td>" +


results.getString("blah") + "</td></tr>");


}
} catch (Exception ex) {
out.println("<br>");
out.println("Exception: " + ex);
if(ex instanceof SQLException) {
SQLException sqlex = (SQLException) ex;
out.println("<br>");
out.println("SQL state:


"+sqlex.getSQLState()+"<BR>");


out.println("<br>");
out.println("Error code:


"+sqlex.getErrorCode()+"<BR>");


                               out.println("<br><br>");
                               sqlex.printStackTrace(out);
                               out.println("<br><br>");
                       }
       }
       finally {
           try { connection.close(); } catch (Exception ex) {}
       }
               out.println ("</BODY></HTML>");


}
}


On Thu, 7 Oct 2004 09:29:09 -0400, Phillip Qin
<[EMAIL PROTECTED]>
wrote:


Detail, detail, detail.

1. your context.xml
2. your web.xml
3. how do you obtain connection from pool, java code pls. 4. can you
connect using pool 5. commons-pool version

Etc. etc.

You need to provide details otherwise we can't help.



-----Original Message-----
From: Eric Wulff [mailto:[EMAIL PROTECTED]
Sent: October 6, 2004 5:09 PM
To: [EMAIL PROTECTED]
Subject: connection pooling

Hi all, I have gone over some of the tomcat docs and googled errors
but there is SO much information covering JNDI and Datasources...
and I'm hoping I don't have to be a JNDI/Datasource and XML guru
just to set up db connections via connection pool.

My situation is this...

System:
Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
Server 9.4 on Windows Server

-I am able to connect to my db via typical JDBC
DriverManager.getConnection(). -This leads me to believe that my
jdbc driver is in the correct place ...CATALINA

--------------------------------------------------------------------
-
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]

!DSPAM:4165a84c9322136420805!




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:4165bb7715701366110907!





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--


:) Atishay Kumar Btech, SEM VII DA-IICT Gandhinagar - 382009 India ph: +91 9825383948 /**************************************************************************** * Learn the rules as you would need them to break them properly * ****************************************************************************/




--------------------------------------------------------------------- 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]



Reply via email to