JNDI Problem - Confusing....
rkbeach Jun 25, 2003 8:31 PMHi All,
I am confronted with a puzzling problem...
Environment:
Weblogic 7
JBoss 3.0.4
Solaris 2.8
What I am trying to do:
An MDB running in the Weblogic context (running on machine A) looks up a Session Bean deployed under JBoss (running on machine B). This reference (home reference) is stored in a HashMap for re-use,
since JNDI lookups can be expensive. This Home Reference is used to create a remote reference.
Now, the problem I am running into:
The above mechanism works fine when I first start the WL Server,the JBoss server, and lookup the Session Bean (this is stored in the HashMap, for re-use) using JNDI (see below for code). So long as the JBoss
App Server is up and running, everything works fine.
When I bounce the JBoss App Server, and try to use the SessionBean Home reference (stored in the HashMap) to create a remote reference,
I get a java.rmi.NoSuchObjectException -- which is understandable, since the JBoss App Server is bounced.
After I catch the java.rmi.NoSuchObjectException, I am trying to lookup the Session Bean deployed under Jboss (using the same piece of code that I used initially to perform the lookup) from the MDB running in Weblogic context, and all I get is a 'null' object. NO EXCEPTIONS ARE THROWN EITHER. Until I bounce
the Weblogic Server, I am not able to lookup the Session Bean deployed in JBoss App Server.
What am I doing wrong? Can you please help?
Code that I am using to perform the lookup:
public InitialContext getJBContext() {
Properties props = null;
InitialContext initCtx = null;
try {
props = new Properties();
props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.put("java.naming.provider.url", "jnp://:");
initCtx = new InitialContext(props);
} catch (Exception ex) {
e.printStackTrace();
}
}
When I use the above obtained InitialContext, and do a lookup like "Object obj = getJBContext().lookup("invoiceBean");" the returned Object is 'null'. As I mentioned above, this happens after I bounce the JBoss App Server, and wouldn't go away until I bounce the Weblogic App Server as well.
Thanks much,
Srini