-
1. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
jaikiran Jan 23, 2014 7:31 AM (in response to ravipatil080)Post the entire exception stacktrace and the what does the implementation of njdbcExtractor.getNativeResultSet look like?
-
2. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
jesper.pedersen Jan 23, 2014 9:01 AM (in response to ravipatil080)WrappedResultSet wrs = (WrappedResultSet)rs;
OracleResultSet ors = (OracleResultSet)wrs.getUnderlyingResultSet();
-
3. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
ravipatil080 Jan 24, 2014 2:33 AM (in response to jaikiran)Hi Jay,
NativeJdbcExtractor comes from spring package :
org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor
The stacktrace is :
Caused by: java.lang.ClassCastException: org.jboss.jca.adapters.jdbc.jdk6.WrappedResultSetJDK6 cannot be cast to oracle.jdbc.OracleResultSet
at com.myorg.business.OrderBusiness.validateExtendable(OrderBusiness.java:962)
at com.myorg.business.OrderBusiness.orderCommit(OrderBusiness.java:742)
at com.myorg.business.OrderBusiness$$FastClassByCGLIB$$ad523028.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at com.myorg.business.OrderBusiness$$EnhancerByCGLIB$$8614975f.orderCommit(<generated>)
at com.myorg.business.OrderBusiness$$FastClassByCGLIB$$ad523028.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.myorg.framework.aop.ChunkingInterceptor.invoke(ChunkingInterceptor.java:33)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.myorg.framework.aop.DatabaseContextInterceptor.invoke(DatabaseContextInterceptor.java:264)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at com.myorg.business.OrderBusiness$$EnhancerByCGLIB$$7db09169.orderCommit(<generated>)
at com.myorg.impl.OrderImpl.orderCommit(OrderImpl.java:224)
at com.myorg.impl.OrderImpl$$FastClassByCGLIB$$945214e8.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.myorg.framework.aop.DebugInterceptor.invoke(DebugInterceptor.java:204)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.myorg.framework.aop.SecurityInterceptor.invoke(SecurityInterceptor.java:491)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:126)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:50)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at com.myorg.impl.OrderImpl$$EnhancerByCGLIB$$2fa29894.orderCommit(<generated>)
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:597)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:104)
at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:56)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:79)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:329)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$100(MethodInvocationMessageHandler.java:70)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:203)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Thanks,
Ravi
-
4. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
pmm Jan 24, 2014 4:47 PM (in response to ravipatil080)This should do the trick:
OracleResultSet ors = rs.unwrap(OracleResultSet.class);
-
5. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
ravipatil080 Jan 25, 2014 8:12 AM (in response to pmm)Phillippe, It does work! Thanks. But I want to use the Spring based Native Jdbc Extractor.
I want to know why it doesn't work in JBoss when the same lines of code works fine in weblogic.?
I agree that JBOSS has WrappedResultSetJDK6 which the other way implements java.sql.ResultSet. But still there should not be code inconsistency I believe.
-
6. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
jaikiran Jan 25, 2014 9:27 AM (in response to ravipatil080)Ravi Patil wrote:
I agree that JBOSS has WrappedResultSetJDK6 which the other way implements java.sql.ResultSet. But still there should not be code inconsistency I believe.
Typically you wouldn't need to get the underlying ResultSet and you would just work with the standard Java API and that's where the code would be portable and consistent. However, since the application you are using appears to be require the underlying OracleResultSet, you have to resort to vendor specific APIs. Apparently WebLogic doesn't require any special handling to get to the underlying ResultSet but it's not mandated that, that be the case.
-
7. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
ravipatil080 Jan 27, 2014 6:02 AM (in response to jaikiran)Thanks Jai,
Then with JBoss to get the underlying ResultSet, we must unwrap. Isn't it you mean?
-
8. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
pmm Jan 27, 2014 12:02 PM (in response to ravipatil080)Ravi Patil wrote:
Phillippe, It does work! Thanks. But I want to use the Spring based Native Jdbc Extractor.
You could use JBossNativeJdbcExtractor but if you can do it with standard JDBC API in a way that's portable across application servers and doesn't even require Spring then I have to ask why.
-
9. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
ravipatil080 Jan 28, 2014 2:47 AM (in response to pmm)Hi Phileppe,
Keeping Weblogic App Server in mind for a while, I have not checked your suggested fix. But the ResultSet that we get while using weblogic will be "ResultSet" Unlike Jboss's WrappedResultSetJDK6. Will the unwrap work over there?
-
10. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
ravipatil080 Jan 29, 2014 12:01 AM (in response to pmm)Will it be the same case for WrappedConnectionJDK6, I think we get "no wrapper available for OracleConnection"
-
11. Re: ClassCastException: WrappedResultSetJDK6 cannot be cast to OracleResultSet
pmm Jan 28, 2014 11:39 AM (in response to ravipatil080)Ravi Patil wrote:
Hi Phileppe,
Keeping Weblogic App Server in mind for a while, I have not checked your suggested fix. But the ResultSet that we get while using weblogic will be "ResultSet" Unlike Jboss's WrappedResultSetJDK6. Will the unwrap work over there?
It should because the JDBC specification requires it.