Here's one of the lookups we are trying to perform (in java):
InitialContext namingContext = new InitialContext();
Object dmObject = namingContext.lookup("DataManagerService");
Thanks for the link PeterJ.
We're running Red Hat Enterprise Linux ES release 4 (Nahant Update 4) for our OS.
As a test, I tried to lookup a different service, such as JNDIView. When I call lookup() it hangs indefinitely, so the program never returns from the lookup() method at all. I tried the telnet localhost 1099 numerous times, and have even used the IP returned from the telnet command (as discussed in the link PeterJ sent) and still no luck. When I go into the JMX Console, it does say that DataManagerService is running and I can invoke methods from the JMX Console (as well as the JNDIView MBean).
I'm very new to JBoss and MBeans, unfortunately, and our server administrator is also new to it. Any ideas?
Is your lookup code in an application deployed to JBoss or in a separate client application?
If the former, get rid of all of the addToEnvironment calls.
If the later, is the client application on the same system as JBoss or on a remote system?
Did you update your /etc/hosts file as was suggested in my other post? Of course, substituting your IP address in for the one I used.
The lookup code is in a client application, and the client application is on the same machine as JBoss. The /etc/hosts file contains the correct IP address of the machine with the simple & full hostname.
If I remove the addToEnvironment, the client app is unable to figure out what JNDI info to use, so it throws the javax.naming.NoInitialContextException exception. I will attempt to replace the addEnvironment calls to a "new Properties(...)" call to see if that helps.
In the meantime, have you encountered the "lookup()" call not returning before?
Follow up: I loaded the environment with "new Properties(..)" and it still hangs on the call to lookup()
Many months ago I attempted to connect a client (running on Windows) to JBoss JNDI on Linux and it did not work (can't recall if I got a timeout, or if it hung, or what). Even after setting my iptables properly (you do have ports 1099 and 1098 open?), I still had problems. So I googled the exception and eventually found the solution I outlined in the other post. But as I noted, I'm not sure if the problem was the client hanging.
I had another thought. Try running JBoss with the JVM option: -Djava.net.preferIPv4Stack=true
Sometimes the JVM gets confused and tries to use a IPv6 stack, this option tells it not do to that.
Thanks Peter, I've forwarded your suggestion onto our system administrator.
Is there a way that I could test if the JNDI stuff is even being exposed on the JBoss server? (like a different test program, ideally written in Java). Also, is there anything I'm missing as far as connection factoriy information from the jndi.properties?
To test JNDI, use the jmx-console, select the jboss:service=JNDIView MBean. One the details page, click the invoke button for the list() method. The resulting page displays all of the naming trees.
Follow up: Ok, I just didn't know if there was another quick Java sample to do it, but that works too. :)
The one I'm looking for is located in the Global JNDI Space, called "DataManagerService" (at the root level of the tree). So lookup("DataManagerService") should work just fine (I tried jnp://... but no luck either).
(sorry I mixed up the jnp:// with java:)
update: Ok, we tried running JBoss with the -Djava.net.preferIPv4Stack=true and that also did not work. The JBoss server we are running comes with the Adobe LiveCycle product line and is version 3.2.5. We will be talking with Adobe about their "turnkey" setup and installation of JBoss to see if they've encountered any issues like the ones we're having.
If anyone has any other suggestions, we would appreciate it!