我正在为客户端层中的对象(SERIALIZABLE 对象)创建代理,并将此对象发送到 EJB(在 Weblogic 10.3.4 服务器上使用 EJB 3.0)。在 EJB 中,参数为空!我确保我发送的对象在客户端中不为空,并且它是可序列化的(System.out.println(c instanceof Serializable) 打印为 true)。可能是什么问题呢?
// Creating the proxy
public Object createProxy(Class targetClass)
{
Enhancer enchancer = new Enhancer();
enchancer.setSuperclass(targetClass);
enchancer.setInterfaces(new Class[] { Serializable.class })
enhancer.setCallback(new LazyInterceptor()); // LazyInterceptor implements Serializable
return enhancer.create();
}
在客户端创建对象:
SomeClass c = new SomeClass(); // SomeClass implements Serializable
getTestService.test(c); // In this call, the parameter in the EJB is **not** null
c = (SomeClass)createProxy(c.getClass());
System.out.println(c instanceof Serializable); // This prints out true
getTestService.test(c); // In this call, the parameter in the EJB is null!