简体   繁体   English

Websphere上StructDescriptor的ClassCastException,但tomcat不在

[英]ClassCastException of StructDescriptor on websphere but not on tomcat

My Application was working fine on my local tomcat server. 我的应用程序在本地tomcat服务器上运行良好。 But later I deployed it in the WebSphere by making a war file. 但是后来,我通过制作war文件将其部署在WebSphere中。 After the deployment, whenever I try to make a call to the stored procedure using the StructDescriptor as follows, I am getting ClassCastException. 部署后,每当我尝试按如下所示使用StructDescriptor调用存储过程时,都会收到ClassCastException。 Following is my code segment: 以下是我的代码段:

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));

And the error that is thrown is : 而引发的错误是:

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)

The object that was created in the data base is as follows: 在数据库中创建的对象如下:

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

I tried to search on different forms and didn't get any solution. 我尝试搜索不同的表单,但没有任何解决方案。 Please help. 请帮忙。

Use WSCallHelper.getNativeConnection to "unwrap" the OracleConnection contained in WSJdbcConnection: 使用WSCallHelper.getNativeConnection来“解包” WSJdbcConnection中包含的OracleConnection:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM