----- Original Message -----
From: Remy Maucherat <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 11, 2001 1:47 PM
Subject: Re: Using JNDI with Jakarta-Tomcat 4.0 beta 3


> > Hi,
> >
> > I have been using Jakarta-Tomcat 3.2.1 and when I upgraded to the 4.0
beta
> 3
> > I have a propblem with my JNDI configuration.
> >
> > I have a servlet that uses an EJB container that requires the following
> > "jndi.properties" :
> >
> > java.naming.factory.initial
> > com.sun.jndi.rmi.registry.RegistryContextFactory
> > java.naming.provider.url             rmi://localhost:1099
> > java.naming.factory.url.pkgs       org.objectweb.jonas.naming
> >
> > With 3.2.1 I just needed to make sure that I had my jndi.properties file
> on
> > the classpath, with 4.0 beta 3 I do not seem to be able to get this read
> by
> > any means. The only mechanism that I found to get this to work is if I
> call
> > "System.setProperty()" in my servlet just before I call "new
> > javax.naming.InitialContext()". If I do not do this I get the following
> > error message:
> >
> > javax.naming.NoInitialContextException: Cannot instantiate class:
> > org.apache.naming.java.javaURLContextFactory.  Root exception is
> > java.lang.ClassCastException:
org.apache.naming.java.javaURLContextFactory
> >
> >
> > Can anyone tell me how I am supposed to set this for my servlet? I tried
> the
> > following without any success:
> >
> > 1) Using env-entry in my WEB-INF/web.xml
> > 2) Putting the jndi.properties into the classpath
>
> That will fail, since Catalina ignores your classpath.
> Try putting the jndi.properties in common/classes/jndi.properties. It
should
> work better.
>
> Note that to use JNDI related stuff (esp with load-on-startup), I
recommend
> using the latest nightly.
>
> Remy
>
I have also had success in 4.0 B2 setting the -D
java.naming.factory.url.pkgs=org.objectweb.jonas.naming
parameter on Tomcat Start script.
Then I use ctx.lookup("rmi://localhost:1099"); to obtain the context of the
ejb server.
Also, 4.0 B2 supports the <ejb-ref> tags including the full redirection of
the lookup to the EJB server (via url factory context)..
Tim



Reply via email to