tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32932] New: - unable to use datasource defined in [context].xml in tomcat 5.5
Date Tue, 04 Jan 2005 09:18:04 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32932>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32932

           Summary: unable to use datasource defined in [context].xml in
                    tomcat 5.5
           Product: Tomcat 5
           Version: 5.5.6
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: mkmelin+apache@cc.hut.fi


Using a datasource defined in conf/Catalina/localhost/[context].xml don't work
in tomcat 5.5.4 - 5.5.6a. The same setup worked with no problems in 5.0.28. 

I have tested with 5.5.4 and 5.5.6a. Both fail (regression from 5.0.28). 

Here is the stacktrace:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null'
	at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
	at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
	at my.package.dao.informix.InformixPollDAO.retrievePoll(Unknown Source)
	at my.package.actions.RetrievePollAction.execute(Unknown Source)
	at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:674)
	at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:465)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:400)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:303)
	at my.package..WorkaroundURLsFilter.doFilter(Unknown Source)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
	at com.informix.jdbc.IfxDriver.checkURL(IfxDriver.java:454)
	at com.informix.jdbc.IfxDriver.acceptsURL(IfxDriver.java:278)
	at java.sql.DriverManager.getDriver(DriverManager.java:232)
	at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)
	... 31 more

With the following [context].xml

<Context path="/test" docBase="test"
        debug="5" reloadable="true" >

  <!-- Set up the datasource to be used throughout the application.  -->
  <Resource name="jdbc/MyTestInformixDatasource"
            auth="Container"
            type="javax.sql.DataSource">
  </Resource>

  <ResourceParams name="jdbc/MyTestInformixDatasource">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>

    <parameter>
      <name>ifxHOST</name>
      <value>xx.xx.com</value>
    </parameter>

    <parameter>
      <name>portNumber</name>
      <value>1526</value>
    </parameter>

    <parameter>
      <name>datbaseName</name>
      <value>MyTest</value>
    </parameter>

    <!-- Informix DB username and password for DB connections  -->
    <parameter>
     <name>user</name>
     <value>test</value>
    </parameter>
    <parameter>
     <name>password</name>
     <value>test</value>
    </parameter>

    <parameter>
     <name>serverName</name>
     <value>ol_xxx</value>
    </parameter>

    <!-- Class name for Informix JDBC driver -->
    <parameter>
       <name>driverClassName</name>
       <value>com.informix.jdbc.IfxDriver</value>
    </parameter>

    <!-- The JDBC connection url for connecting to the Informix DB. -->
    <parameter>
      <name>url</name>
     
<value>jdbc:informix-sqli://xx.xx.com:1526/MyTest:INFORMIXSERVER=ol_xxx;user=test;password=test</value>
    </parameter>
    
  </ResourceParams>
</Context>


The code to get the connection:

    protected static DataSource getDataSource() throws PollDAOSysException {
        DataSource ds = null;
        try {
            Context ctx = new InitialContext();
            if (ctx == null) {
                if (log.isErrorEnabled()) {
                    log.error("No context!");
                }

                throw new PollDAOSysException("No context!");
            }
            ds = (DataSource) ctx.lookup(JNDIConstants.INFORMIX_RESOURCE);
        }
        catch (Exception e) {
            if (log.isErrorEnabled()) {
                log.error(
                    "Looking up datasource " + JNDIConstants.INFORMIX_RESOURCE,
                    e);
            }
            throw new PollDAOSysException(
                "Error looking up datasource " + JNDIConstants.INFORMIX_RESOURCE);
        }

        return ds;
    }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message