Announcement Announcement Module
Collapse
No announcement yet.
Cast ConnectionHandle to OracleConnection Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cast ConnectionHandle to OracleConnection

    Hi there!

    I am struggling with..
    CASTING: org.tranql.connector.jdbc.ConnectionHandle
    TO: oracle.jdbc.OracleConnection

    My system is using the following topology:
    - Application is built using Spring's JdbcTemplate functionality
    - Geronimo 3.0 - Tomcat 7 (release) which uses JNDI for the Oracle datasource .
    - JDBC Driver Class: oracle.jdbc.driver.OracleDriver
    - Pool Type: TranQL Generic JDBC Resource Adapter
    (As I write this I am guessing if the issue is the pool type, but not sure)....


    Anyways, this is the error I am getting:
    Code:
    2012-08-13 15:40:33,461 ERROR [LoadRepairDataJdbcImpl] execution error
    java.lang.ClassCastException: org.tranql.connector.jdbc.ConnectionHandle cannot be cast to oracle.jdbc.OracleConnection
    	at oracle.sql.TypeDescriptor.setPhysicalConnectionOf(TypeDescriptor.java:848)
    	at oracle.sql.TypeDescriptor.<init>(TypeDescriptor.java:615)
    	at oracle.sql.StructDescriptor.<init>(StructDescriptor.java:302)
    	at com.autologic.bl.framework.base.StoredProcedureTemplate$2.createTypeValue(StoredProcedureTemplate.java:236)
    	at org.springframework.jdbc.core.support.AbstractSqlTypeValue.setTypeValue(AbstractSqlTypeValue.java:58)
    	at org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:267)
    	at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:216)
    	at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:127)
    	at org.springframework.jdbc.core.CallableStatementCreatorFactory$CallableStatementCreatorImpl.createCallableStatement(CallableStatementCreatorFactory.java:212)
    	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1008)
    	at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1064)
    	at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:144)
    	at com.autologic.bl.ontario.sp.spring.jdbc.LoadRepairDataJdbcImpl.executeStoreProcedure(LoadRepairDataJdbcImpl.java:65)
    	at com.autologic.bl.ontario.sp.spring.jdbc.LoadRepairDataJdbcImpl.executeStoreProcedure(LoadRepairDataJdbcImpl.java:1)
    	at com.autologic.bl.framework.base.StoredProcedureTemplate.execute(StoredProcedureTemplate.java:63)
    	at com.autologic.bl.ontario.ws.soap.RepairDataService.loadRepairData(RepairDataService.java:106)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.apache.axis2.jaxws.server.dispatcher.JavaDispatcher.invokeTargetOperation(JavaDispatcher.java:83)
    	at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.invoke(JavaBeanDispatcher.java:98)
    	at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:111)
    	at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:169)
    	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
    	at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
    	at org.apache.geronimo.axis2.pojo.POJOWebServiceContainer.processXMLRequest(POJOWebServiceContainer.java:146)
    	at org.apache.geronimo.axis2.Axis2WebServiceContainer.processPOSTRequest(Axis2WebServiceContainer.java:420)
    	at org.apache.geronimo.axis2.Axis2WebServiceContainer.doService2(Axis2WebServiceContainer.java:346)
    	at org.apache.geronimo.axis2.Axis2WebServiceContainer.doService(Axis2WebServiceContainer.java:273)
    	at org.apache.geronimo.axis2.Axis2WebServiceContainer.invoke(Axis2WebServiceContainer.java:234)
    	at org.apache.geronimo.webservices.WebServiceContainerInvoker.service(WebServiceContainerInvoker.java:84)
    	at org.apache.geronimo.webservices.POJOWebServiceServlet.service(POJOWebServiceServlet.java:79)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    	at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:730)
    	at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:48)
    	at org.apache.geronimo.tomcat.valve.ProtectedTargetValve.invoke(ProtectedTargetValve.java:53)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    	at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:243)
    	at org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:373)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)

    This is the code being executed:
    Code:
    	protected static <T extends EntityMapper> AbstractSqlTypeValue adaptObjectToDbStruct(final T objT) {
    		if (logger.isLoggable(Level.FINEST)) {
    	         logger.entering(CLASS_NAME, "adaptObjectToDbStruct");
    		}
    		
    		AbstractSqlTypeValue retVal =
    			new AbstractSqlTypeValue() {
    				protected Object createTypeValue(Connection con, int sqlType, String typeName) throws SQLException {
    					// log activity
    					if (logger.isLoggable(Level.FINEST)) {
    						for (Object o : objT.getInputArgs()) {
    							logger.logp(Level.FINEST, CLASS_NAME, "adaptObjectToDbStruct", "Object", o);
    						}
    					}
    					
    					// transform
    					// -- Need the native connection for special types like:  ARRAY, STRUCT, etc..
    					Connection connNative = DbUtil.getNativeConnection(con);
    					StructDescriptor desc = new StructDescriptor(typeName, connNative);
    					STRUCT data = new STRUCT(desc, connNative, objT.getInputArgs());
    					return data;
    				}
    			};
    		
    		if (logger.isLoggable(Level.FINEST)) {
    	         logger.exiting(CLASS_NAME, "adaptObjectToDbStruct");
    		}
    		return retVal;
    	}
    In here the error comes when passing the connection to "StructDescriptor desc = new StructDescriptor(typeName, connNative);". The call to "DbUtil.getNativeConnection(con);" is just a generic function for handling the unwrapping of the connections (i.e. WSCallHelper for WebSphere).

    I have tried defining the NativeJdbcExtractor in the applicationContext.xml or in the code unwrapping the connection myself with the implementations of this extractor.. but I still get ConnectionHandle and not the OracleConnection.

    What am I missing? Thanks for pointers! (oh! this is JAVA, sorry). LOL!

  • #2
    I am not sure if the unwrapping is a bug in TranQL so I cross reference.
    http://jira.codehaus.org/browse/TQL-...comment-306181

    Comment


    • #3
      UPDATE - RESOLVED

      This was an issue with the TranQL (v1.7) stack deployed by Geronimo v3.0 which is not compatible with Oracle latest drivers which support JDBC 4 specification.

      All information at:
      https://jira.codehaus.org/browse/TQL...comment-306715

      Questions or comments at:
      http://jonnazario.blogspot.com/2012/...on-unwrap.html
      Last edited by correodejoscar; Aug 23rd, 2012, 02:31 PM.

      Comment


      • #4
        OracleConnection does not support a ConnectionTimeout property.

        Plagiarism Checker
        marina bay sands singapore infinity pool
        Last edited by Aries86; Jan 23rd, 2014, 10:19 PM.

        Comment

        Working...
        X