lookupLocally failed for comp
dsconnelly May 20, 2002 8:16 AMOK, gimme a hint..
I am a JBoss newbie. But, I have figured out by now that
the JBoss naming service (out of the box) does not provide a standard JNDI ENC to all the client programs of an applciation.
Or, it would prefer to do this client-by-client,everybody getting his
own unique JNDI ENC. No recognition (out of the box) that all the clients of an application should see a common JNDI ENC.
The Sun J2EE RI, on the other hand, does provide a standard JNDI ENC to all clients of the same EAR, and
it does this without any fuss.
Running against the Sun J2EE the all the clients can do
jndiInitial.lookup("java:comp/env/ejb/myBean");
and it works fine, returning a ref for myBean to all clients. In JBoss, the preference seems to be that I do a different lookup, a lookup on the EJB's own JNDI name directly. Or, that I do some setup for each client program, individually.
But Sun's looser coupling (through the JNDI ENC) with a common lookup for all cooperating clients is better for portability, it seems to me. The JNDI ENC is a good thing if you don't want to have to change your source code for every server.
It really would be nice if my Sun client programs ran with JBoss as the server. The exact same code all around. I might like to bind in a test EJB in place of the production EJB by hacking the JNDI ENC as we go along. This should be possible without a lot of fuss.
There must be some simple hack to get this to work without having to make separate clients for J2EE and JBoss.
Do I hack the JNP URL, or some other client sysprop or do I hack the jboss.xml that goes with my EJB jar?
The server says this when I do my standard JNDI ENC lookup from the client:
08:00:38,096 ERROR [HAJNDI] lookupLocally failed for comp
javax.naming.NameNotFoundException: comp not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
at org.jboss.ha.jndi.HAJNDI.lookupLocally(HAJNDI.java:230)
at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:174)
at java.lang.reflect.Method.invoke(Native Method)
etc.
I am using JBoss 3.0 RC2, although I don't think this makes any difference here. It seems that this is the normal situation for JBoss. What do I do to make the Sun J2EE naming service operation "normal" for JBoss?
Dan Connelly
Prosoft Technologies, Inc.