Object ref = jndiContext.lookup( "CustomerHome");
-----Original Message-----Hi Mark,
From: Ronald Wildenberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 05, 2002 10:37 AM
To: [EMAIL PROTECTED]
Subject: Re: JRun/JNDI QuestionNot sure if this helps, but I do not think you need the Properties
map. I suppose that you are deploying your servlets and your beans
in the same application server. The properties should be known
already then.If you are running a client application outside the application server
you should provide for these properties.Ronald Wildenberg
"Galbreath, Mark" wrote:
JRun's documentation sucks and it's code examples use deprecated methods. Does anybody know the correct means to get a JNDI reference to an EJB home interface from a servlet? I've tried most everything, but what I got before pulling the rest of my hair out and quitting is a servlet containing, in part:
Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup( "java:comp/env/ejb/CustomerHome");
* * *
public static Context getInitialContext() throws NamingException {
Properties p = new Properties();
p.setProperty( Context.PROVIDER_URL, "ejipt://192.168.0.1:8100");
p.setProperty( Context.INITIAL_CONTEXT_FACTORY, "allair.ejipt.ContextFactory");
return new InitialContext( p);
}The PROVIDER_URL is the port for my JRun Server. The INITIAL_CONTEXT_FACTORY is what the documentation says is correct, although there is an InitialContextFactory class in another package. And the JNDI lookup is in the recommended form. I've also tried the put() method of Property. No matter what, ref is always null.
A couple of interesting things:
(1) I am not getting a NullPointerException (nor any other error) when calling the servlet from a browser - just a page with some test HTML output from a PrintWriter() statement prior to the JNDI lookup;
(2) assert always throws a NullPointerException:
assert ref == null;
assert ref != null;
assert ref.equals( null);I know this is happening because the Rams lost the SB...Appreciate any insight(s) you guys may have.
Mark
