facebook

Strange problem with Tomcat 5.5 and Connection pooling

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #266283 Reply

    I have a very strange problem with Tomcat 5.5 and connection pooling and MyEclipse IDE:

    When I run my web-app in the debugger (started from MyEclipse IDE) I get the following error message:

    2007-02-19 14:56:15,530 ERROR [ch.smartsol.bl.TxpCodetable] – org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class ‘ianywhere.ml.jdbcodbc.IDriver’
    2007-02-19 14:56:15,530 ERROR [ch.smartsol.bl.TxpCodetable] – org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class ‘ianywhere.ml.jdbcodbc.IDriver’

    When I start Tomcat from outside the MyEclipse IDE the driver is found, the pool is created and the connections are correctly established at startup:

    AbandonedObjectPool is used (org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool@1549f94)
    LogAbandoned: true
    RemoveAbandoned: true
    RemoveAbandonedTimeout: 300
    AbandonedObjectPool is used (org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool@1f6df4c)
    LogAbandoned: true
    RemoveAbandoned: true
    RemoveAbandonedTimeout: 300

    I am using Eclipse 3.2 WITHOUT WTP but with MyEclipse 5.1.

    I defined my JDBC resources in context.xml inside my web-app. The JDBC driver resides ONLY in ${CATALINA_HOME}/common/lib directory.

    Any idea what is missing when running Tomcat inside MyEclipse IDE??

    Tom

    #266323 Reply

    Riyad Kalla
    Member

    Tom,
    Having the driver under common/lib should be enough. but since Tomcat isn’t finding it when launched from MyEclipse, you can force it to find it by editing the Tomcat connector settings, under Paths, and just using the “Append to classpath” box and adding it there to make sure.

    #266352 Reply

    Riyad,

    Hmm, does not help anything!!

    I just added some debug code to output the classpath:

    log.debug("classpath: "+System.getProperty("java.class.path"));
    final Context initCtx = new InitialContext();
    final Context envCtx = (Context) initCtx.lookup("java:comp/env");
    final DataSource ds = (DataSource) envCtx.lookup(ConnectionName);
    cn = ds.getConnection();
    

    The ds.getConnection() call throws the exception. Note that jodbc.jar is the JDBC driver and it contains the missing driver ‘ianywhere.ml.jdbcodbc.IDriver’. Here is the output:

    2007-02-20 07:39:43,331 DEBUG main [ch.smartsol.bl.TxpCodetable] – classpath: D:\JavaLibs\jodbc.jar;D:\apache\Tomcat55/bin/bootstrap.jar;C:\Java\JDK1.5.0_05/lib/tools.jar
    2007-02-20 07:39:43,331 DEBUG main [ch.smartsol.bl.TxpCodetable] – classpath: D:\JavaLibs\jodbc.jar;D:\apache\Tomcat55/bin/bootstrap.jar;C:\Java\JDK1.5.0_05/lib/tools.jar
    2007-02-20 07:39:43,331 DEBUG [main] bl.TxpCodetable (TxpCodetable.java:75) – classpath: D:\JavaLibs\jodbc.jar;D:\apache\Tomcat55/bin/bootstrap.jar;C:\Java\JDK1.5.0_05/lib/tools.jar
    2007-02-20 07:40:30,566 ERROR main [ch.smartsol.bl.TxpCodetable] – org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class ‘ianywhere.ml.jdbcodbc.IDriver’
    2007-02-20 07:40:30,566 ERROR main [ch.smartsol.bl.TxpCodetable] – org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class ‘ianywhere.ml.jdbcodbc.IDriver’
    2007-02-20 07:40:30,566 ERROR [main] bl.TxpCodetable (TxpCodetable.java:135) – org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class ‘ianywhere.ml.jdbcodbc.IDriver’

    The surprising thing is also:

    Why does it output every message TWICE???

    Any help would be greatly appreciated.

    Tom

    #266353 Reply

    Riyad,

    Got it solved! My driver is based on a native driver DLL. What you need to add instead of the jar file in the classpath is the path of that DLL in the ‘append to library path’ section!

    Tom

    #266376 Reply

    Riyad Kalla
    Member

    Ahh, nice catch Tom. Glad it’s working now.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Strange problem with Tomcat 5.5 and Connection pooling

You must be logged in to post in the forum log in