Troubleshooting EJB 3 remote clients
The expected outcome is a dummy echo print on the Console when running the client. However the things to checkout are many and so the number of possible errors. A quite common error in the forum of developers is:
Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
The checklist for this error includes:
- Have you added JBoss's client libraries to your project ?
- Maybe you are using a wrong JNDI root context. For example, instead of the correct
you might be using:
Another common issue is:
No EJB receiver available for handling [appName:,modulename:,distinctname:as7project] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@10f6d3
In this case, there's a mismatch between module name and distinct name. (Look at the underlined section). Check your JNDI building String
On the other hand, here the error looks the same but the module name is correct:
No EJB receiver available for handling [appName:,modulename:as7project,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@7b7072
Here, you should check your JNDI again, maybe you have uncorrectly stated your remote EJB name or your remote EJB implementation class. For example, instead of the correct
you might be using:
Here's one more issue:
WARN: Could not register a EJB receiver for connection to remote://192.168.1.1:4447
java.lang.RuntimeException: Operation failed with status WAITING
This is commonly caused by a wrong combination of IP or port in the file jboss-ejb-client.properties.
- You might be unable to reach that host address
- Maybe you are using a port-offset on that server, so instead of port 4447 you should use 4447 + offset
One more issue:
Exception in thread "main" javax.naming.NamingException: No provider URL configured for connection
Chances are that you are trying to initialize older JBoss InitialContextFactory.
For example, maybe you have got:
If so, remove that line from your code!
- << Prev