Jay SenSharma

Jay SenSharma

If we use any Generic implementation in EJB3.0 deployed on weblogic Server then we face some errors like following:

package test;
import java.util.List;
public interface TestGenericsInEJB3
public List callPlainMethod();
public List<User> callGenericMethod();

If our EJB3 Bean uses the above Interface as a remote Interface then we will find the following kind of exception while invoking it remotely.

java.lang.AssertionError: Can not find generic method public abstract java.util.List<test.
TestGenericsInEJB3> callGenericMethod() in EJB Object
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.getTargetMethod(RemoteBusinessIntfProxy.java:159)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:53)
at $Proxy79.
callGenericMethod(Unknown Source)
at jsp_servlet.__index._jspService(__index.java:53)

There are two following possibilities for the above Exception:

Case-1: When the business interface extends java.rmi.Remote, and extends some generic methods from a super class, the deployment will fail.
Workaround: This case is a limitation in WLS 10.3 or greater and hence no workaround applicable.

Case-2: When the business interface doesn’t extend java.rmi.Remote, the invocation on the generic business methods will fail.
Workaround: It can be resolved by downloading the needed classes from the server side. If network downloading is disabled, however, the invocation will fail still.

If network downloading isn’t permitted in the user’s environment, it is recommended that you run appc first, then add the generated classes to the classpath of the client side. Please refer to the following link to see how we can generate the EJB Client Jar: http://middlewaremagic.com/weblogic/2010/04/02/generating-ejb3-clientjar/

Jay SenSharma

If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.