jboss AS 7.1.1 - ejb local interface reference from different application on same server fails
gmlopezdev May 6, 2013 7:04 PMHi,
I'm trying to create a reference to an ejb on a different application (ear) within the same server/jvm and get an error which appears to be classloading related but I do not know whether it is a server error or a development/deployment error. This is the layout of my project
appA
- lib
- appB-interfaces.jar
- ejbA.jar
- webappA.war
appB
- lib
- appB-interfaces.jar (referenced by appA and local app)
- ejbB.jar
- webappB.war
B's interfaces and implementation are as the following:
@Local
public interface MyLocalInterface{}
@Stateless
public class MyEJBImplementation implements MyLocalInterface{}
The component within project "A" is as the following:
public class MyComponent {
@EJB(lookup="java:global/appB/module-ejb/MyEJBImplementation!my.project.MyLocalInterface")
private MyLocalInterface myLocalInterface;
When I try to run the application I get the following error:
javax.ejb.EJBException: java.lang.IllegalArgumentException: Can not set my.project.MyLocalInterface field MyComponent.myLocalInterface to my.project.MyLocalInterface$$$view2
Even I originally tested this on jboss as 7.1.1 I also tried it on 7.1.3 and failed the same way...
Any help/hint will be highly appreciated!
It is worth to notice that if I try to access the bean using the remote interface it is working almost correctly... I can successfully get to B's code however I get an exception while marshaling DateTime from joda-time library:
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_13]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_13]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_13]
at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_13]
at org.jboss.marshalling.reflect.SerializableClass.callReadResolve(SerializableClass.java:325)
at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:260)
at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:231)
at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)
at org.jboss.marshalling.cloner.SerializingCloner$StepObjectInput.doReadObject(SerializingCloner.java:738)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:57)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:363) [rt.jar:1.7.0_13]
at org.joda.time.chrono.ISOChronology$Stub.readObject(ISOChronology.java:231) [joda-time-2.2.jar:2.2]
Update: The last problem appears to be related and resolved on jboss 7.1.3 as per this jira issue: https://issues.jboss.org/browse/AS7-4984