1 Reply Latest reply on Oct 23, 2002 4:39 PM by sleeper

    3.0.3 InitialContext not using jndi.properties

    sleeper Newbie

      hi,

      i'm running into a problem in looking up InitialContext. i'm using jboss-3.0.3_tomcat-4.1.12 on winnt.

      thanks in advance for your help.

      here is the code snippet
      ======================================================
      InitialContext ctx = new InitialContext();
      Map m = ctx.getEnvironment();
      for (Iterator i=m.keySet().iterator(); i.hasNext();) {
      Object key = i.next();
      Object val = m.get(key);
      System.out.println(key + ":\t" + val);
      }

      Object ref = ctx.lookup(GroupMgr.LOOKUP_NAME);
      ======================================================

      here is my jndi.properties
      ======================================================
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=jnp://172.16.3.147
      ======================================================

      and here is the error, note that the inititial ctx did pick up the property values
      ======================================================
      java.naming.factory.initial: org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url: 172.16.3.147
      java.naming.factory.url.pkgs: org.jboss.naming:org.jnp.interfaces


      Exception in thread "main" javax.naming.CommunicationException. Root exception
      is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
      java.net.ConnectException: Connection refused: connectjava.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:137)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:124)
      at java.net.Socket.(Socket.java:268)
      at java.net.Socket.(Socket.java:95)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:20)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:115)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:494)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:169)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:78)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:456)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:440)
      at javax.naming.InitialContext.lookup(InitialContext.java:345)
      ======================================================