On Sun, 25 Feb 2001, Steve Salkin wrote:

> > 
> > Of course, I had it set to 
> > 
> > 1. other machine's hostname
> > 2. IP address
> > 3. the above with the port number.
> > 
> > Then I tried the same thing on the same machine where JBoss is running and
> > used localhost there, to no avail. 
> 
> OK, you're probably thinking that I'm an idiot, or that I think you are, but
> I had to ask :)

It's OK. 

I've tried many things. Here is a code snippet
      /*
         Hashtable env = new Hashtable();
         env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
         env.put(Context.PROVIDER_URL, "localhost:1099");
         System.out.println ("Trying to get InitialContext");
         Context context = new InitialContext(env);
      */
         System.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
         System.setProperty("java.naming.provider.url",
"localhost:1099");

         Context context = new InitialContext();
         System.out.println ("Created new InitialContext");

         System.out.println ("Looking up Context");
         context = (Context) context.lookup("java:comp");

this is a part of JbossWebXmlReader class, a Request Interceptor for
TomCat that reads web.xml and jboss-web.xml from WAR's META-INF directory
and exports appropriate environment entries to JNDI.

Indeed, it seems that jndi.properties is not picked up properly, so I set
the properties in the code.

I've done what you've recommended -- the property gets set and the call to
new InitialContext() just hangs.

If you remove all the setup of properties or the environment, then
InitialContext() gets created but lookup of "java:comp" fails saying that
the naming factory is not setup or something of that sort.

So, I am pretty sure that the setting are getting picked up, it seems,
though that JNDI hangs in trying to establish a connection? JBoss is
running and the naming server reports that it is running on port 1099.

If this helps in any way, here is another mystery. If I modify
jndi.properties in jboss/conf/default and uncomment
java.naming.provider.url=localhost entry, JBoss hangs as well on JBossMQ
startup. 




> 
> Maybe the next thing is to instrument the code with a bit of debugging. For
> one thing, maybe just before the getInitialContext() call print out
> System.getProperty("java.naming.factory.initial") and
> System.getProperty("java.naming.provider.url")
> to make sure that your jndi.properties is indeed getting picked up and
> not just masking your earlier problem in some other way.
> 
> I think something must be wrong in there if this doesn't work on the same
> box.
> 
> S-
> 
> 
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]
> 
> 



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to