I originally posted this at elephantwalker but have had little response,
hopefully someone here has some ideas...
I'm trying to lookup a bean on a remote machine. I set up initial context in
usual way using properties taken from the jndi.properties on the remote oc4j
server.
In fact I want to lookup the bean from within a web-app (or ejb) installed
on a local oc4j server. When I attempt it all I get is
NullPointerException: domain was null.
Does anyone know what this means?
Some more info:
I do the lookup programmatically. If I run it as a standalone client (not
what I want to do) I get an error telling me the Factory can't find
application-client.xml - this is not surprising as it's not on my classpath.
Running from local container gives the error above. I have added an entry to
orion-application.xml:
<ejb-module remote="true" path="myremoteapp-ejb" />
and entries for the beans deployed there into my local oc4j servers'
application-client.xml
Here's the code I'm using to do the lookup:
Hashtable env = new Hashtable();
env.put("java.naming.provider.url",
"ormi://remotemachineIP:rmiport/myremoteapp");
env.put ("java.naming.factory.initial",
"com.evermind.server.ApplicationClientInitialContextFactory");
env.put("java.naming.security.principal", "myremoteapp");
env.put("java.naming.security.credentials", "password");
targetEJB_URI = "java:comp/env/" + targetEJB_URI;
EJBHome ejbRef = null;
Context ic = new InitialContext(env);
//ejbRef = (EJBHome)PortableRemoteObject.narrow(ic.lookupLink
(targetEJB_URI), EJBHome.class);
ejbRef = (EJBHome) ic.lookupLink (targetEJB_URI);
One other thing is if I use the RMIInitialContextFactory instead then the
context lookup works if I'm running as a standalone client. I then only get
a naming exception since it can't see application-client.xml
Any help appreciated.
Thanks,
Chris.