1 Reply Latest reply on Mar 4, 2004 2:58 AM by themuppeteer

    Application can not connect to JBoss over the internet :((

    themuppeteer

      Hello Guys,

      I have an application that wants to connect to my JBOSS 3.2.2 application server over the internet.
      It all runs fine local, but when I run it from another computer, my client can not connect.
      My application is a Jar file.

      I removed 2 files from the meta-inf directory SUN_MICR.RSA and SUN_MICR.SF. This had to be done because otherwise I got security exceptions.

      I think my ISP blocks all ports under the 2000, so I already tried to change ports in jboss-service.xml file. I changed the rmi port and listen port to something bigger, here is the sample...:

      ----------------------- jboss-service.xml -----------------

      <!-- The listening port for the bootstrap JNP service. Set this to -1
      to run the NamingService without the JNP invoker listening port.
      -->
      9099
      <!-- The bootstrap JNP server bind address. This also sets the default
      RMI service bind address. Empty == all addresses
      -->

      <!-- The port of the RMI naming service, 0 == anonymous -->
      9098
      <!-- The RMI service bind address. Empty == all addresses
      -->



      ----------------------------------------------------------

      and I connect in my client (and also in my application server, when beans are talking to each other)

      -------------------- MyClient code: getInitialcontext ----
      private Context getInitialContext(String ip,String port) throws NamingException
      {
      Hashtable environment = new Hashtable();
      environment.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      environment.put(Context.PROVIDER_URL,ip+":"+port);
      environment.put(Context.SECURITY_PRINCIPAL, "guest");
      environment.put(Context.SECURITY_CREDENTIALS, "guest");
      return new InitialContext(environment);
      }
      ---------------------------------------------------------

      I used to place jnp:// before the ip, but I read on a site that I should not do that when working over the internet.. don't know if its true, but anyway my exception changd by removing it (from CommunicationException to ConnectionException).
      it goes wrong when I try to create the home interface of one to one of my beans = when I use the ctx for the first time...


      Here is the exception...

      java.rmi.ConnectException: Connection refused to host: (my ip address); nested exception is:
      java.net.ConnectException: Connection timed out: connect
      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.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Sour
      ce)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvo
      kerProxy.java:135)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
      a:96)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
      java:46)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:4
      5)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      at $Proxy0.create(Unknown Source)
      at MoehahaClient.Login.jButtonConnect_actionPerformed(Login.java:168)
      at MoehahaClient.Login_jButtonConnect_actionAdapter.actionPerformed(Logi
      n.java:276)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
      67)
      at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
      ctButton.java:1820)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
      .java:419)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257
      )
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
      istener.java:258)
      at java.awt.Component.processMouseEvent(Component.java:5021)
      at java.awt.Component.processEvent(Component.java:4818)
      at java.awt.Container.processEvent(Container.java:1525)
      at java.awt.Component.dispatchEventImpl(Component.java:3526)
      at java.awt.Container.dispatchEventImpl(Container.java:1582)
      at java.awt.Component.dispatchEvent(Component.java:3367)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3359
      )
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3074)

      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3004)
      at java.awt.Container.dispatchEventImpl(Container.java:1568)
      at java.awt.Window.dispatchEventImpl(Window.java:1581)
      at java.awt.Component.dispatchEvent(Component.java:3367)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
      read.java:191)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
      ad.java:144)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)

      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)

      at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
      Caused by: java.net.ConnectException: Connection timed out: connect
      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(RMIDirect
      SocketFactory.java:22)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
      SocketFactory.java:122)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
      ... 36 more



      Can anyone help me please ?
      Any hints, thoughts are highly appreciated..I'm already searching for 3 days on this and its driving me (and my girlfriend since I'm spending way too much time on the pc ;)) crazy.

      Thnx!

        • 1. Re: Application can not connect to JBoss over the internet :
          themuppeteer

          Just came to tell part of the solution...

          I simply forgot to portableRemoteObject.narrow my class...

          Now I have a
          javax.naming.CommunicationException: Receive timed out [Root exception is java.n
          et.SocketTimeoutException: Receive timed out]
          at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:11
          15)
          at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1192)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:514)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
          at javax.naming.InitialContext.lookup(Unknown Source)
          at MoehahaClient.Login.jButtonConnect_actionPerformed(Login.java:161)
          at MoehahaClient.Login_jButtonConnect_actionAdapter.actionPerformed(Logi
          n.java:287)

          error...
          can start looking again...