Jboss AS 7 remote EJB 3.1 ClassCastException from 2 different ears
da_andrea Nov 20, 2012 5:07 AMHi to all i am studyng ejb 3.1 and jboss as 7
I would like to understand haw call a remote ejb from another ear
like in this example:
i have 2 ears
like in this example below
in the same app server i have 2 ear :
myapp.ear
|
|
|
+------------------- myappEJB.jar
|
| @Stateless
+ it.test.MyEjb public class MyEjb implements MyEjbRemote
|
| @Remote
+ it.test.MyEjbRemote public interface MyEjbRemote {
test.ear
|
|
|
+------ testweb.war
|
|
+ --------------------- WEB-INF
|
|
+ classes
|
|
+ it.test.MyEjbRemote (is the copy of the interface)
|
|
+ it.test.servlet TestServlet
String url = "java:global/myapp/myappEJB/MyEjb!it.test.ejb.MyEjbRemote";
Context ctx = new InitialContext();
MyEjbRemote remote = (MyEjbRemote) ctx.lookup(url);
i always receive the same error :
java.lang.ClassCastException: it.test.ejb.MyEjbRemote$$$view1 cannot be cast to it.test.ejb.MyEjbRemote
My question is haw i could call the remote EJB ?
And Haw i could call the EJB if the ejb was installed in another machine ?
With previous versions of jboss i used the prefix jnp:// etc
what change now ?
thank you very much Andrea