Problems with Remote EJB and related documentation
morphy Nov 23, 2011 6:42 PMHi people,
i was trying to implement a remote client to perform an Hello World operation using the guide in the documentation (https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI).
I've found some strange behaviors, in the following scenario:
- latest sucessful build (AS7.1.CR1-SNAPSHOT)
- domain configuration
- 2 servers in the same group configured with ha-sockets
here it is:
- dependency jboss-ejb-client was not in the jboss maven repository, workaround is an install:install-file
- jndiProperties requires jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.as.naming.InitialContextFactory"); in addition to the Context.URL_PKG_PREFIXES
- the previous point means that the client requires the additional dependency jboss-as-naming 7.0.2.Final
- the EJB namespace ejb: isn't it JEE6 standard, right? is it a not implemented specification or vendors are free?
Finally, the test code fails with the following exception:
[WARNING] java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassCastException: org.jboss.ejb.client.naming.ejb.EjbNamingContext cannot be cast to com.hp.dragon.test.HelloWorlder at com.hp.dragon.test.TheApp.run(TheApp.java:63) at com.hp.dragon.test.TheApp.main(TheApp.java:35) ... 6 more
attached the test code, following a quick view of TheApp.java:63
HelloWorlder proxy = (HelloWorlder) context .lookup("ejb:TestRemoteBean/HelloWorlderBean!com.hp.dragon.test.HelloWorlder");
thank you, hope to help
PS the app has been run using mvn exec:java -Dexec.mainClass, so i expect that the classpath is correct
-
TestRemote.tar.gz 2.7 KB