There is supposed to be a jndi.properties file in the conf/default or
equivalent
jboss dist directory  that either does not set the provider url or has it
commented out. This sets only the initial context factory and the prefix
url packages.

----- Original Message -----
From: "Tim Taylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 15, 2001 10:40 AM
Subject: RE: [JBoss-user] NamingService initialization
problems--ConnectionException


> Scott, thanks for the reply.  I get an NPE when I delete the
jndi.properties
> file.
>
> Here's the code for org.jboss.naming.NamingService.initService() in JBoss
> 2.2.1.  Without the jndi.properties file, the System.getProperties... line
> gets an NPE.  With the jndi.properties file in place, the Context ctx =
...
> line gets a ConnectionException.  If the jndi.properties file contains no
> provider url, the Context ctx = ... line gets a ConfigurationException
> saying "Provider URL missing."
>
> Tim Taylor
>
> public void initService()
>    throws Exception
> {
>    // Read jndi.properties into system properties
>    // RO: this is necessary because some components (=Tomcat servlets) use
a
>
>    // buggy classloader that disallows finding the resource properly
>
>
System.getProperties().load(Thread.currentThread().getContextClassLoader().g
> etResourceAsStream
>    ("jndi.properties"));
>
>    // Create "java:comp/env"
>    RefAddr refAddr = new StringRefAddr("nns", "ENC");
>    Reference envRef = new Reference("javax.naming.Context", refAddr,
> ENCFactory.class.getName(), null);
>    Context ctx = (Context)new InitialContext().lookup("java:");
>    ctx.rebind("comp", envRef);
> }



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to