> 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

Reply via email to