0
votes

I am writing a remote client for an EJB running in JBoss AS EAP6.2. Following instructions in Section "7.5.1. Invoke a Session Bean Remotely using JNDI" in "JBoss EAP 6.2 Development Guide", I am able to access methods on the EJB if I use the JNDI name

<ejb:/hibernate-ejb-server/UserBean!org.ktest.study.beans.UserBean

but fails if I use the global JNDI name that is actually logged in the JBoss server logs

java:global/hibernate-ejb-server/UserBean!org.ktest.study.beans.UserBean

If I use the global JNDI name, I get the below exception

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

After searching on the web, I understand that I must provide some properties (related to javax.naming) to InitialContext while instantiating it. But I am not sure what these properties are. Could someone please help me with this?

1

1 Answers

2
votes

"java:global" will never work to access a remote server. Even when you execute it against a remote initial context, it will be resolved in the local JVM.

It's one of the many oddities associated with JNDI.