Hey
"Gebers, Andre" wrote:
> put this in your servlet code:
>
> System.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingC
> ontextFactory");
> System.setProperty("java.naming.provider.url","localhost:1099");
> InitialContext ctx = new InitialContext();
> Object objref = initial.lookup("ejb/User");
This really should work *anyway*, but since it doesn't here's what I
would recommend:
protected Context getInitialContext()
throws NamingException
{
try
{
Properties cfg = new Properties();
cfg.load(getClass().getResourceAsStream("/jndi.properties"));
return new InitialContext(cfg);
} catch (IOException e)
{
NamingException ne = new NamingException("Could not read
jndi.properties");
ne.setRootCause(e);
throw ne;
}
}
--
Put this in your servlet (or base servlet) and call it whenever you need
a context. When we get this to work properly simply change it to new
InitialContext().
regards,
Rickard
--
Rickard �berg
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]