3 Replies Latest reply on Jun 7, 2005 6:41 PM by M W

    ClassCastException from org.jboss.resource.adapter.jdbc.Wrap

    M W Newbie

      I'm trying to migrate an application that works in Tomcat 5.5.9 to JBoss 4.0.2 and am hitting a wall. I've spent a significant amount of time trying between googling and trying to identify the problem with no success.

      The project was originally built using Oracle's BC4J. I've created a jboss-web.xml file to deploy with the application (shown below). I can see database connections, but ClassCastException has me thinking that Oracle is returning an object JBoss doesn't know how to handle.

      Has anyone else run into a ClassCastException with JBoss' WrappedPreparedStatement when using BC4J or know of an explanation? Any pointers or suggestions are appreciated.


      In TC 5.5.9, this is the working project.xml file (conf/Catalina/localhost/):

      <Context path="/project" docbase="project" reloadable="true" debug="1">
       <Resource name="jdbc/projectDS"
       auth="Container"
       type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
       factory="oracle.jdbc.pool.OracleDataSourceFactory"
      driverClassName="oracle.jdbc.driver.OracleDriver"
       username="scott"
       password="tiger"
       url="jdbc:oracle:thin:scott/tiger@devsystem:2026:devsid"/>
      
       <Resource name="jdbc/anotherDS"
       auth="Container"
       type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
       factory="oracle.jdbc.pool.OracleDataSourceFactory"
      driverClassName="oracle.jdbc.driver.OracleDriver"
       username="scott"
       password="tiger"
       url="jdbc:oracle:thin:@devsystem:2026:devsid"/>
      
       <Resource name="jdbc/projectTxnDS"
       auth="Container"
       type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
       factory="oracle.jdbc.pool.OracleDataSourceFactory"
      driverClassName="oracle.jdbc.driver.OracleDriver"
       username="scott"
       password="tiger"
       url="jdbc:oracle:thin:@devsystem:2026:devsid"/>
      </Context>



      Here's the jboss-web.xml (I also tried changing javax.sql.DataSource to oracle.jdbc.pool.OracleConnectionPoolDataSource without any success).

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-web>
       <resource-ref>
       <res-ref-name>jdbc/anotherDS</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <jndi-name>java:/anotherDS</jndi-name>
       </resource-ref>
       <resource-ref>
       <res-ref-name>jdbc/projectDS</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <jndi-name>java:/projectDS</jndi-name>
       </resource-ref>
       <resource-ref>
       <res-ref-name>jdbc/projectTxnDS</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <jndi-name>java:/projectTxnDS</jndi-name>
       </resource-ref>
      </jboss-web>
      


      And here's the exception being thrown:
      java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrappedPreparedStatement
       at oracle.jbo.server.OracleSQLBuilderImpl.doStatementSetRowPrefetch(OracleSQLBuilderImpl.java:908)
       at oracle.jbo.server.DBTransactionImpl.createPreparedStatement(DBTransactionImpl.java:2757)
       at oracle.jbo.server.DBTransactionImpl2.createPreparedStatement(DBTransactionImpl2.java:418)
       at oracle.jbo.server.DBTransactionImpl.createReUsePreparedStatement(DBTransactionImpl.java:3529)
       at oracle.jbo.server.ViewObjectImpl.getPreparedStatement(ViewObjectImpl.java:6800)
       at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:517)
       at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:2837)
       at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:539)
       at oracle.jbo.server.ViewRowSetImpl.executeDetailQuery(ViewRowSetImpl.java:586)
       at oracle.jbo.server.ViewObjectImpl.executeDetailQuery(ViewObjectImpl.java:2801)
       at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:2788)
       at com.companyname.project.business.view.query.BrandContactQueryViewImpl.findByBrandCodeContactType(Unknown Source)
       at com.companyname.project.web.common.action.BaseAction.readBrandInfo(Unknown Source)
       at com.companyname.project.web.common.action.ApplicationStartAction.process(Unknown Source)
       at com.companyname.project.web.common.action.BaseAction.execute(Unknown Source)
       at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
       at com.companyname.project.web.RequestProcessorExt.processActionPerform(Unknown Source)
       at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
       at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
       at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       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:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       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.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
       at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
       at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
       at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
       at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Thread.java:595)