2016-04-25 3 views
0

Meine Anwendung funktionierte auf meinem lokalen Tomcat-Server. Später habe ich es jedoch in WebSphere implementiert, indem ich eine WAR-Datei erstellt habe. Nach der Bereitstellung, wenn ich versuche, einen Aufruf an die gespeicherte Prozedur mit dem StructDescriptor wie folgt zu starten, erhalte ich ClassCastException. mein Code-Segment folgend:ClassCastException of StructDescriptor auf websphere, aber nicht auf tomcat

StructDescriptor projectTypeDesc = StructDescriptor.createDescriptor(
     "FRA_DATA.REGION_TYPE", st.getConnection()); 
STRUCT[] structs = new STRUCT[filterDTO.getRegion().size()]; 
for (int i = 0; i < filterDTO.getRegion().size(); ++i) { 
    int str = (int) filterDTO.getRegion().get(i).intValue(); 
    Object[] objects = new Object[] { str }; 
    STRUCT struct = new STRUCT(projectTypeDesc, st.getConnection(), 
      objects); 
    structs[i] = struct; 
} 
ArrayDescriptor arrayDescriptor = ArrayDescriptor.createDescriptor(
     "FRA_DATA.REGIONS", st.getConnection()); 
arrayList.add(new ARRAY(arrayDescriptor, st.getConnection(), structs)); 

Und die Fehler, die ausgelöst wird, ist:

java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection incompatible with oracle.jdbc.OracleConnection 
    at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:169) 
    at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:140) 
    at com.citi.oprisk.cpa.repository.impl.ReportRepositoryImpl.setFilterArraysForOracle(ReportRepositoryImpl.java:310) 
    at com.citi.oprisk.cpa.repository.impl.ReportRepositoryImpl.getCommonProcessSystemReportUsingSP(ReportRepositoryImpl.java:385) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:600) 
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) 
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) 
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) 
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) 
    at com.sun.proxy.$Proxy2088.getCommonProcessSystemReportUsingSP(Unknown Source) 
    at com.citi.oprisk.cpa.service.impl.CpaReportServiceImpl.getCommonProcessReport(CpaReportServiceImpl.java:271) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:600) 
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) 
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) 
    at com.sun.proxy.$Proxy2089.getCommonProcessReport(Unknown Source) 
    at com.citi.oprisk.cpa.controller.CpaDashboardController.getCommonProcessSystemReport(CpaDashboardController.java:98) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:600) 
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222) 
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) 
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) 
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814) 
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737) 
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) 
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) 
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) 
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969) 
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) 
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1661) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:944) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:507) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:181) 
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3954) 
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276) 
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:945) 
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592) 
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:191) 
    at com.ibm.ws.ard.channel.ARDChannelConnLink.handleDiscrimination(ARDChannelConnLink.java:188) 
    at com.ibm.ws.ard.channel.ARDChannelConnLink.ready(ARDChannelConnLink.java:93) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277) 
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) 
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) 
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) 
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) 
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1656) 

Das Objekt, das in der Datenbank erstellt wurde, ist wie folgt:

CREATE OR REPLACE TYPE region_type AS OBJECT (region NUMBER); 
CREATE OR REPLACE TYPE regions AS TABLE OF region_type; 

habe ich versucht, nach verschiedenen Formen zu suchen und keine Lösung gefunden. Bitte helfen Sie.

Antwort

0

Verwenden WSCallHelper.getNativeConnection auf "auszupacken" die OracleConnection in WSJdbcConnection enthalten:

StructDescriptor projectTypeDesc = StructDescriptor.createDescriptor(
     "FRA_DATA.REGION_TYPE", 
     WSCallHelper.getNativeConnection(st.getConnection())); 
Verwandte Themen