10 Steps to Fix Remote EJB Issues in JBoss EAP

A while back, we spent hours with a client on an EJB issue only to realize it was something simple.

Don’t you hate that?

Usually, if you configure Remote EJBs perfectly, they just work. But if not, the lack of logging makes it hard to find a solution.

I hope this guide saves you the trouble.

Here are ten steps we took to resolve Remote EJB issues in JBoss

1. Start with a standalone client

A standalone EJB client provides more useful logging information than JBoss.

  • Deploy this example EJB to your destination server
  • Run this ejb standalone client (the dest server must be reachable from your computer)
    java -jar ejb-standalone-client-{version}.jar {host} {port} {username} {password}
  • Check the top of the logs

If you see, “Could not register a EJB receiver for connection” –> Goto Step 2

If you see,  “Authentication failed:” –> Goto Step 4

If you see, , Hello World!” –> Goto Step 6

2. Check your connection settings

Check the host and port attributes. And make sure your server is running 🙂

3. Check the binding IP address of your destination server

Your destination server must bind to the IP address you are trying to connect to. This is done at startup.

Ex. ./domain.sh -b 192.168.56.101

4. Check your authentication

The username and password in the standalone client should match the one on your destination server. If you’re using domain mode, check that this user is added to every host node in your domain. You must run the add user script (add-user.sh) on each node.

5. Make sure the example EJB was deployed successfully

You should see deployment messages like

java:jboss/exported/ejb-server-side/MyEJB!org.codelikethewind.ejbserver.RemoteEJB

6. Check your client settings

Open jboss-ejb.properties and the (domain/standalone.xml) of your client server. Verify the following are the same.

jboss-ejb-client.propertiesdomain/standalone.xml
UsernameUsername in remote-outbound-connection
PasswordBase64 decoded security-key* in your security-realm**
Host & Porthost/port in remote-outbound-socket

* You can decode your password here

** In domain mode, this realm should be in your host.xml of each server

Finally, check that your remote-outbound connection references the correct remote-outbound socket and security-realm

7. Check your Remote EJBs

Your EJB should be annotated as @Remote. And you should see java/jboss/exported JNDI messages for your EJB in the logs

8. Check the EJB JNDI string in your client code

Open the startup logs for your destination server and look for your EJB deployment. For example:

java:jboss/exported/ejb-server-side/MyEJB!org.codelikethewind.ejbserver.RemoteEJB

Replace “java:jboss/exported” with “ejb:”

ejb:/ejb-server-side//MyEJB!org.codelikethewind.ejbserver.RemoteEJB

This should be the string you use in your code.

Note: Unless you specified one, you will not have a distinct-name. But you still need to include the forward slash.

EJB JNDI Syntax Reference

9. Check your EJB client descriptor

If your top level deployment is a WAR, your descriptor (jboss-ejb-client.xml) should be in src/webapp/WEB-INF/

If your top level deployment is an EAR, your descriptor (jboss-ejb-client.properties) should be in src/main/resources/META-INF/

10. Check your server names

The client and “destination” server names must be distinct.

If you are running two standalone instances, make sure their node names are different

You can change the node names with a startup flag

-Djboss.node.name=node1

If you are running in two domains, make sure the servers in domain 1 have different names than the servers in domain 2.

You can change the server-name attribute in the host.xml file, under <servers>

Good luck & Happy Coding,

-T.O.

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑