-
1. Re: Problem in running Remote EJB Client Example
alesj Jul 19, 2012 7:36 PM (in response to jeryslo)Perhaps try first from CLI, and then from m2e.
It could be that the class is not yet compiled?
e.g. missing the "compile" part of Maven cmd
-
2. Re: Problem in running Remote EJB Client Example
jeryslo Jul 20, 2012 4:24 AM (in response to alesj)Ok I have successfully compiled with Maven build in eclipse. I also checked under directory and now class exists. But when I run it as Java Application it gives out this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/as/quickstarts/ejb/remote/stateless/RemoteCalculator
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.lookupRemoteStatelessCalculator(RemoteEJBClient.java:129)
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.invokeStatelessBean(RemoteEJBClient.java:50)
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.main(RemoteEJBClient.java:37)
Caused by: java.lang.ClassNotFoundException: org.jboss.as.quickstarts.ejb.remote.stateless.RemoteCalculator
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more
It looks like the RemoteCalculator, which is deployed on the server is not found. How is this possible?
-
3. Re: Problem in running Remote EJB Client Example
jeryslo Jul 20, 2012 4:35 AM (in response to jeryslo)Ok I have solved this problem with configuring run configuration for Java Application. For some reason under ClassPath->User Entries I had only Maven dependencies and jboss-as-ejb-remote-client, so I added jboss-as-ejb-remote-server-side to user entries and the application starts. Unfortunately it does not complete successfully. Here is what it prints out:
jul 20, 2012 10:27:28 AM org.jboss.ejb.client.EJBClient <clinit>
INFO: JBoss EJB Client version 1.0.5.Final
Obtained a remote stateless calculator for invocation
Adding 204 and 340 via the remote stateless calculator deployed on the server
jul 20, 2012 10:27:29 AM org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.3.GA
jul 20, 2012 10:27:29 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.3.GA
jul 20, 2012 10:27:29 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.3.GA
jul 20, 2012 10:27:29 AM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
INFO: Received server version 1 and marshalling strategies [river]
jul 20, 2012 10:27:29 AM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
INFO: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@ea9cf9, receiver=Remoting connection EJB receiver [connection=Remoting connection <7a8313>,channel=jboss.ejb,nodename=jernej-pc]} on channel Channel ID 97ee0450 (outbound) of Remoting connection 00d95bc3 to localhost/127.0.0.1:4447
jul 20, 2012 10:27:29 AM org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleMessage
WARN: Unsupported message received with header 0xffffffff
Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:jboss-as-ejb-remote-app,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@12be8e1
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
at $Proxy0.add(Unknown Source)
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.invokeStatelessBean(RemoteEJBClient.java:56)
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.main(RemoteEJBClient.java:37)
Strange problem. As can one see from the stack trace, the application successfully receives the object, but the is something wrong when the add method is called. Does anybody have even slightest idea what is going wrong here?
-
4. Re: Problem in running Remote EJB Client Example
jeryslo Jul 20, 2012 5:11 AM (in response to jeryslo)Jesus. It looks like the quickstart code is wrong. I took a look into server log, where it prints out JNDI bindings for deployed EJB jar and this is what it has printed out:
10:03:18,638 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named CalculatorBean in deployment unit deployment "jboss-as-ejb-remote-server-side.jar" are as follows:
java:global/jboss-as-ejb-remote-server-side/CalculatorBean!org.jboss.as.quickstarts.ejb.remote.stateless.RemoteCalculator
java:app/jboss-as-ejb-remote-server-side/CalculatorBean!org.jboss.as.quickstarts.ejb.remote.stateless.RemoteCalculator
java:module/CalculatorBean!org.jboss.as.quickstarts.ejb.remote.stateless.RemoteCalculator
java:jboss/exported/jboss-as-ejb-remote-server-side/CalculatorBean!org.jboss.as.quickstarts.ejb.remote.stateless.RemoteCalculator
java:global/jboss-as-ejb-remote-server-side/CalculatorBean
java:app/jboss-as-ejb-remote-server-side/CalculatorBean
java:module/CalculatorBean
The I looked into the RemoteEJBClient, where it looks up in the context. Here is the code:
return (RemoteCalculator) context.lookup( "ejb:/jboss-as-ejb-remote-app/CalculatorBean!" + RemoteCalculator.class.getName() );
It should be:
return (RemoteCalculator) context.lookup( "ejb:/jboss-as-ejb-remote-server-side/CalculatorBean!" + RemoteCalculator.class.getName() );
Now the example works perfectly.
-
5. Re: Problem in running Remote EJB Client Example
alesj Jul 20, 2012 5:26 AM (in response to jeryslo)Afaik, the quickstart code is on github.
Care for a pull-request with a fix? ;-)
-
6. Re: Problem in running Remote EJB Client Example
jeryslo Jul 20, 2012 5:35 AM (in response to alesj)Please do it instead of me. I have not used github very extensively and I am not sure if this is really a bug. Maybe they tested this quickstart with jar nammed
jboss-as-ejb-remote-app
. Is it possible that the project was nammed that way and they changed it tojboss-as-ejb-remote-server-side
but forgot to change in the source code? -
7. Re: Problem in running Remote EJB Client Example
sgilda Jul 20, 2012 8:08 AM (in response to jeryslo)I created an issue for this and will take care of it: https://github.com/jboss-jdf/jboss-as-quickstart/issues/307
Thanks!
-
8. Re: Problem in running Remote EJB Client Example
jaikiran Jul 20, 2012 8:23 AM (in response to jeryslo)1 of 1 people found this helpfulThis isn't a bug in the quickstart but it looks like an issue with the Maven plugin in Eclipse which you are using for deploying the application. The pom.xml is correctly configured to deploy it as jboss-as-ejb-remote-app https://github.com/jboss-jdf/jboss-as-quickstart/blob/master/ejb-remote/server-side/pom.xml#L81. It looks like the Eclipse plugin doesn't honour that.
-
9. Re: Problem in running Remote EJB Client Example
sgilda Jul 20, 2012 8:50 AM (in response to jeryslo)Jaikiran, you are right. I just tried this and it works fine. I will close the issue.