クライアント層でオブジェクト (SERIALIZABLE オブジェクト) へのプロキシを作成し、このオブジェクトを EJB に送信します (Weblogic 10.3.4 サーバーで EJB 3.0 を使用)。EJB では、パラメータが null です。送信しているオブジェクトがクライアントで null でないこと、およびそれがシリアライズ可能であることを確認しました (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!