1 Reply Latest reply on Mar 28, 2004 4:26 PM by harinair

    jndi/jndi.properties are being ignored

       

      "mwalker" wrote:
      "mwalker" wrote:
      When I attempt to run the examples on a remote client using the included build.xml, I get the ever delightful

      [java] javax.naming.CommunicationException: Receive timed out. Root exception is java.io.InterruptedIOException: Receive timed out
      [java] at java.net.PlainDatagramSocketImpl.receive(Native Method)
      [java] at java.net.DatagramSocket.receive(DatagramSocket.java:387)
      [java] at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1038)
      [java] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1127)
      [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:478)
      [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
      [java] at javax.naming.InitialContext.lookup(InitialContext.java:345)
      [java] at com.titan.clients.Client_51a.main(Client_51a.java:30)

      So, I put something erroneous into my jndi.properties, e.g.

      java.naming.factory.initial=org.jnp.interfaces.USOutOfIraqContextFactory

      and nothing changes. However, when I hard code the jndi props, ala ..

      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
      p.put(Context.PROVIDER_URL, "jnp://192.168.0.3:1099");
      return new javax.naming.InitialContext(p);

      ...then it works fine, or when I bypass ant and run it from the following shell script...

      #------------------------------------

      #! /bin/bash
      cd build/classes

      JBOSS_LIB="$JBOSS_HOME"/client

      if [ -n "$CLASSPATH" ] ; then
      LOCALCLASSPATH="$CLASSPATH"
      fi


      for i in "${JBOSS_LIB}"/*.jar
      do
      if [ "$i" != "${JBOSS_LIB}/*.jar" ] ; then
      if [ -z "$LOCALCLASSPATH" ] ; then
      LOCALCLASSPATH=$i
      else
      LOCALCLASSPATH="$i":"$LOCALCLASSPATH"
      fi
      fi
      done

      LOCALCLASSPATH=./:../../jndi/:"$LOCALCLASSPATH"

      java -cp "$LOCALCLASSPATH" com.titan.clients.Client_51b
      #------------------------------------

      it also works. I don't have any random jndi.props files laying around my home directory. Is this all because of the jndi.properties (setting ProviderURL to local host) buried in one of the client lib jars?
      Does the <include "../jndi/"..> in the build.xml need to be forced to the front of the classpath?
      Also, has anyone else had trouble with the ant included in the workbook examples? I can't get it to stop bitching about org.apache.tools.ant.Main? Using the ant that comes with SuSE 8.1 (or the latest tar installed on my SuSE 7.3 box) seems to do the trick

      vital stats...
      SuSE 8.1/7.3
      jboss-3.2.1_tomcat-4.1.24
      AMD Hardware

      Thanks in advance for any guidence...


        • 1. Re: jndi/jndi.properties are being ignored
          harinair

          Hi mwalker -

          You have actually done a woderful debugging. It is for sure that a jndi.properties file is picked up from somewhere - may be it is in one of the jar files you have in the classpath (most probably a default jndi.properties file from the jboss client jar files). I suggest that you do an echo of the classpath variable in the build.xml run step and look inside all of the jars included classpath.

          As you have already concluded you may be able to run it OK if you add the following path element in the front of the classpath:



          Hope this helps.

          -- Hari Gangadharan