tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ziggy <zigg...@gmail.com>
Subject dbcp error with java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource
Date Thu, 09 Oct 2008 16:12:12 GMT
Hi All,

I am using jdbc to connect to an oracle database but having a bit of a
problem.  Here is some details

Jdbc driver - Type 4
App server - Tomcat 5.5
Oracle Version - 10g

I have placed the jdbc driver on both the following directories

[code]
$TOMCAT_HOME/common/lib/
$APPLICATION_ROOT_DIR/WEB-INF/lib/
[/code]


Here is the stack trace of the error i am getting.

[code]
09/10/2008 16:38:30 ERR http-8080-Processor23
com.bt.ccs21.presentation.events.CCS21EventAction:
Throwable:org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper

java.lang.ClassCastException:
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper

    at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:149)

    at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:115)

    at
com.bt.ccs21.data.accessors.ConsignmentDAO.submitDeclaration(ConsignmentDAO.java:251)

    at
com.bt.ccs21.presentation.events.consignment.search.SubmitDeclaration.midAction(SubmitDeclaration.java:107)

    at
com.bt.ccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:67)

    at
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)

    at
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)

    at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)

    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)

    at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)

    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)

    at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)

    at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)

    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)

    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)

    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)

    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)

    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)

    at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)

    at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)

    at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)

    at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)

    at java.lang.Thread.run(Thread.java:595)
[/code]

Here is the java code to get my connection

[code]
// JNDI
        Context ctx = null;
        DataSource ds = null;
        Connection conn = null;

            ctx = new InitialContext();
            Context envContext  = (Context)ctx.lookup("java:/comp/env");
            if (ctx != null)
            {
                ds = (DataSource)envContext.lookup(fullname);
                if (ds != null)
                {
                    // Enable tracing on this connection...
                    if (jdbcTraceFile != null && ds.getLogWriter() == null)
                    {
                        try
                        {
                            Log.threadLog(Log.DEBUG, CLASSNAME, METHOD +
                                ": setting JDBC trace file on DataSource");
                            jdbcTraceFile.println("Tracing on JDBC
DataSource " + ds.toString());
                            ds.setLogWriter(jdbcTraceFile);
                        }
                        catch (SQLException sqle)
                        {
                            Log.threadLog(Log.ERROR, CLASSNAME, METHOD +
                                ": Exception while setting JDBC trace
file");
                            Log.threadLog(Log.ERROR, CLASSNAME, sqle);
                        }
                    }

                    conn = ds.getConnection();
                }
            }

[/code]

And here is the datasource configuration. This is configured in the
following file $TOMCAT_HOME/catalina/localhost/context.xml

[code]
    <Resource name="jdbc/testdb" auth="Container"
              type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
              url="jdbc:oracle:thin:@10.10.10.10:1521:testdb"
              username="testuser" password="testuser" maxActive="20"
maxIdle="10"
              maxWait="-1"/>
[/code]

The above error is generated if i try to send an oracle.sql.ARRAY object to
a plsql in the database. All i am trying the line of code where the code
raises an exception is shown below (At line 2 in teh code below)

[code]
cst = conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC);

                ArrayDescriptor rectabDescriptor =
ArrayDescriptor.createDescriptor("CCS21_CONSIGNMENTLIST_TYPE",conn);
                ARRAY awbNoHwbs = new
ARRAY(rectabDescriptor,conn,childLessAwbs);
                ARRAY hwbs = new ARRAY(rectabDescriptor,conn,hwbList);


[/code]

Any help will be greatly appreciated.

Thanks in advane.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message