2 Replies Latest reply on May 9, 2002 5:35 AM by Sebastian Hallensleben

    Please, please, please!!

    kiuma Newbie

      It's the 4th time I post here and in the meanwhile i didn't found the solution.
      I have the following code:

      --------------------------------------------------
      import java.io.IOException;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.rmi.PortableRemoteObject;
      import javax.security.auth.callback.*;
      import javax.security.auth.login.*;
      import org.jboss.test.hello.interfaces.*;

      /** A simple session client that access the two secured EJBs as the user
      passed in on the command line.

      @author Scott_Stark@displayscape.com
      @version $Revision: 1.5 $
      */
      public class MySessionClient
      {
      static java.util.Properties env = new java.util.Properties();

      public static void main(String args[]) throws Exception
      {
      System.out.println(Context.INITIAL_CONTEXT_FACTORY);
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL ,"jnp://localhost:1099");
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      InitialContext ctx = new InitialContext(env);
      System.out.println("context created");
      HelloHome home = (HelloHome)ctx.lookup(HelloHome.JNDI_NAME);
      Hello hello = home.create();
      System.out.println(hello.hello("World"));
      hello.remove();
      }
      }

      --------------------------------------------------
      Jboss 2.2.4 up and running.

      "hello.jar" is the one found here.

      jndiview says:

      +- invokers
      | +- helloworld
      | | +- Hello
      +- jmx


      and output is:

      java.naming.factory.initial
      context created
      Exception in thread "main" javax.naming.CommunicationException. Root exception is java.rmi.ConnectException: Connection refused to host: 10.0.0.1; nested exception is:
      java.net.ConnectException: Timeout della connessione
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:365)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at MySessionClient.main(MySessionClient.java:27)
      Caused by: java.net.ConnectException: Timeout della connessione
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
      at java.net.Socket.connect(Socket.java:425)
      at java.net.Socket.connect(Socket.java:375)
      at java.net.Socket.(Socket.java:290)
      at java.net.Socket.(Socket.java:118)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:122)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
      ... 8 more
      --------------------------------------------


      What can I do?
      Please someone help me this time

        • 1. Re: Please, please, please!!
          kiuma Newbie

          It was a network problem, dam. But now I have the following
          error message:

          java.naming.factory.initial
          context created
          Exception in thread "main" java.lang.NullPointerException
          at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:96)
          at $Proxy0.create(Unknown Source)
          at MySessionClient.main(MySessionClient.java:28)


          Do you know the reason why?

          • 2. Re: Please, please, please!!
            Sebastian Hallensleben Newbie

            The second error message does not give much away. Still, do you have all relevant .jars from the JBoss client directory in your client's classpath?

            jboss-client.jar, jboss-j2ee.jar, and jndi.jar might be the candidates to try first.

            /Sebastian