java.io.NotSerializableException:oracle.jdbc.driver.T4CConnection

时间:2017-07-25 10:37:57

标签: ejb remote-access ejb-3.1

环境 - EJB 3.1,Struts 2.2,Wildfly-10.1.0

从Struts 2.2 Action类,我正在远程调用无状态会话bean的方法。此方法返回java.sql.Connection对象。

15:09:40,934 ERROR [stderr] (default task-8) java.lang.RuntimeException: WFLYEJB0054: Failed to marshal EJB parameters
15:09:40,935 ERROR [stderr] (default task-8)         at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:338)
15:09:40,935 ERROR [stderr] (default task-8)         at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:318)
15:09:40,935 ERROR [stderr] (default task-8)         at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:275)
15:09:40,935 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:184)
15:09:40,935 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBObjectInterceptor.handleInvocation(EJBObjectInterceptor.java:58)
15:09:40,935 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
15:09:40,935 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBHomeInterceptor.handleInvocation(EJBHomeInterceptor.java:83)
15:09:40,935 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
15:09:40,935 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:42)
15:09:40,936 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
15:09:40,936 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:138)
15:09:40,936 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
15:09:40,936 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:255)
15:09:40,936 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:200)
15:09:40,936 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:183)
15:09:40,936 ERROR [stderr] (default task-8)         at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146)
15:09:40,936 ERROR [stderr] (default task-8)         at com.sun.proxy.$Proxy70.getConnection(Unknown Source)
15:09:40,936 ERROR [stderr] (default task-8)         at tod.ss.tasm.aehcs.struts2.MyAction.RetrieveOracleConnection(TestAction.java:428)
15:09:40,937 ERROR [stderr] (default task-8)         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:09:40,937 ERROR [stderr] (default task-8)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
15:09:40,937 ERROR [stderr] (default task-8)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
15:09:40,937 ERROR [stderr] (default task-8)         at java.lang.reflect.Method.invoke(Method.java:497)
15:09:40,937 ERROR [stderr] (default task-8)         at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
15:09:40,947 ERROR [stderr] (default task-8) Caused by: java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
15:09:40,948 ERROR [stderr] (default task-8)         at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:253)
15:09:40,948 ERROR [stderr] (default task-8)         at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:128)
15:09:40,948 ERROR [stderr] (default task-8)         at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:335)
15:09:40,948 ERROR [stderr] (default task-8)         ... 116 more

为什么在将远程调用的EJB3会话bean中的java.sql.Connection对象返回到Struts 2.1 Action Class时会发生此错误?什么是解决这个问题的解决方案?

1 个答案:

答案 0 :(得分:-2)

检查是否同时使用数据源连接和外部jdbc瘦客户端连接。尝试删除通过瘦客户端获取的连接。只需尝试一下。