jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Govind Deshpande <govind.deshpa...@gmail.com>
Subject Cannot create JDBC driver of class with Tomcat 4.1.27 and Cactus
Date Tue, 21 Dec 2004 18:53:15 GMT
Hi! all,
I am running into a problem where I get a "Cannot create JDBC driver
of class" error.
Pardon me if this problem has already been adressed on the mailing
list. I am running
my Cactus tests via ANT. The cactified war is created. Then ANT runs the
tests on tomcat 4x container. I specify the server.xml that I would
like my cactus
tests to use. My container definition is as follows.

	        <tomcat4x if="Tomcat.home"
	            dir="${Tomcat.home}" port="${cactus.port}"
	        	serverxml="C:/Projects/build/server.xml"
	            output="testOutput/tomcat4x.out-${to.tstamp}"
	            todir="testOutput/tomcat4x-${to.tstamp}"/>

My context in the specified server.xml is as follows. This
configuration creates the correct
datasource when I run the application on tomcat without using Cactus.
I just can find
the datasource only through cactus. This server.xml is correctly
copied into the temp
directory cactus uses to run the tests.

        <Context path="/abcrm" 
           docBase="abcrm-cactified.war"
           debug="0"
           reloadable="true" crossContext="true">
          <Resource name="jdbc/abcrmDataSource"
          	auth="Container"
          	type="javax.sql.DataSource" />
	  <ResourceParams name="jdbc/abcrmDataSource">
            <parameter>
              <name>factory</name>
              <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </parameter>

            <parameter>
              <name>maxActive</name>
              <value>20</value>
            </parameter>

            <parameter>
              <name>maxIdle</name>
              <value>30</value>
            </parameter>

            <parameter>
              <name>maxWait</name>
              <value>10000</value>
            </parameter>

            <parameter>
              <name>username</name>
              <value>sa</value>
            </parameter>
            <parameter>
              <name>password</name>
              <value>visualdb</value>
            </parameter>

            <parameter>
              <name>driverClassName</name>
              <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
            </parameter>

            <parameter>
              <name>url</name>
              <value>jdbc:microsoft:sqlserver://10.0.10.174:1433;DatabaseName=ABC_CRM_Dev;selectMethod=cursor</value>
            </parameter>

          </ResourceParams>
        </Context>


My JUnit class is as follows:

public class TestLogin extends TestCase {
    public static Test suite() {
        ServletTestSuite suite = new ServletTestSuite();
        suite.addTestSuite(TestLogin.class);
        return suite;
    }
    public void setUp()
    { }
    public void testTemplate() {
        UserLogic userLogic = null;
        User user = null;
        try {
            userLogic = (UserLogic) BusinessManager.getInstance().getObject(
                    UserLogic.class);
            user = userLogic.authenticateUser("gdeshpande");
            assertNull("User should not have been null", user);
        } catch (UserAuthenticationException e) {
            e.printStackTrace();
        } catch (CRMApplicationException e) {
            e.printStackTrace();
        }
    }
    public void tearDown()
    {}
}


The application log stack trace I get is as follows.

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
of class '' for connect URL 'null', cause:
java.lang.NullPointerException
	at java.lang.String.regionMatches(String.java:950)
	at com.microsoft.jdbc.base.BaseURLParser.parse(Unknown Source)
	at com.microsoft.jdbc.base.BaseDriver.acceptsURL(Unknown Source)
	at java.sql.DriverManager.getDriver(DriverManager.java:232)
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:743)
	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)
	at com.smconsulting.dao.impl.JNDIDataSourceManager.requestConnection(JNDIDataSourceManager.java:181)
	at com.amerisourcebergen.crm.daoImpl.security.GlobalDAOImpl.getAllGlobals(GlobalDAOImpl.java:70)
	at com.amerisourcebergen.crm.daoImpl.security.GlobalDAOImpl.getAll(GlobalDAOImpl.java:51)
	at com.amerisourcebergen.crm.businessImpl.security.GlobalLogicClass.getGlobals(GlobalLogicClass.java:51)
	at com.amerisourcebergen.crm.webui.startup.LifeCycleListener.contextInitialized(LifeCycleListener.java:57)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3270)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:3599)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
	at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:307)
	at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
	at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:492)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:400)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
	at org.apache.catalina.core.StandardService.start(StandardService.java:497)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
	at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
	at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)





I get the following from the cactus console output.
   [cactus] Testsuite:
unitTests.com.amerisourcebergen.crm.webui.actions.TestLogin
   [cactus] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.829 sec
   [cactus] Testcase: testTemplate(org.apache.cactus.ServletTestCase):	FAILED
   [cactus] setUp() has been called
   [cactus] junit.framework.AssertionFailedError: setUp() has been called
   [cactus] at unitTests.com.amerisourcebergen.crm.webui.actions.TestLogin.setUp(TestLogin.java:80)
   [cactus] at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:149)
   [cactus] at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
   [cactus] at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
   [cactus] at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:117)
   [cactus] at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
   [cactus] at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
   [cactus] at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:117)
   [cactus] at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
   [cactus] at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
   [cactus] at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:117)
   [cactus] at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
   [cactus] at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
   [cactus] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   [cactus] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
   [cactus] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   [cactus] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
   [cactus] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   [cactus] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   [cactus] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   [cactus] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   [cactus] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   [cactus] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   [cactus] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   [cactus] at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
   [cactus] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
   [cactus] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   [cactus] at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
   [cactus] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   [cactus] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
   [cactus] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   [cactus] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   [cactus] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   [cactus] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
   [cactus] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   [cactus] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   [cactus] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   [cactus] at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
   [cactus] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
   [cactus] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
   [cactus] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
   [cactus] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
   [cactus] at java.lang.Thread.run(Thread.java:534)
   [cactus] Test
unitTests.com.amerisourcebergen.crm.webui.actions.TestLogin FAILED


Sorry for the long post. I greatly appreciate any help I can get.
thanks,
govind
-- 
Govind Deshpande
govind.deshpande@gmail.com

Mime
View raw message