5 Replies Latest reply on Sep 28, 2011 6:17 PM by oszhatife

    Can't access GF3.1 remote EJBs from standalone client

    oszhatife

      My project worked perfectly with GlassFish 3.0.1, 
      but with remote GlassFish 3.1 I can't lookup remote EJB-s from standalone client.
      If the GlassFish 3.1 is local, then I can lookup EJB-s.

      The minimal Eclipse 3.6.2 workspace is available:
      www.dopti.hu/~bboros/workspace_lookup_remote_ejb.zip

      Architecture:

           
      • Debian  server (192.168.0.202) with GlassFish 3.1
      •    
      • Ubuntu client
      •    
      • Eclipse 3.6.2 with the latest Oracle GlassFish plugin

      There is one stateless session bean: SayHello.java

       

       

      package hu.bb;
      import javax.ejb.Stateless;
      package hu.bb;
      
      import javax.ejb.Stateless;
      
      /**
       * Session Bean implementation class SayHello
       */
      @Stateless
      public class SayHello implements SayHelloRemote {
           
           /**
            * Default constructor. 
            */
           public SayHello() {
           }
           
           
           
           public String sayHello(String name) {
                return "Hello " + name;
           }
      }

       

      Remote interface:

      package hu.bb;
      import javax.ejb.Remote;
      
      @Remote
      public interface SayHelloRemote {
      
           public String sayHello(String name);
      }

       

      The application client:

      import javax.naming.InitialContext;
      import javax.swing.JOptionPane;
      
      
      public class Main {
           
           
           public static void main(String[] args) {
                Main app = new Main();
                try {
                     app.execute();
                } catch (Exception e) {
                     e.printStackTrace();
                     JOptionPane.showMessageDialog(null, "Error: " + e.getClass().getName() + " " + e.getMessage());
                }
           }
           
           private void execute() throws Exception {
                InitialContext ic = new InitialContext();
                System.out.println("InitialContext created");
                
                hu.bb.SayHelloRemote sh = null;
                try {
                     String strBean = "java:global/SayHello/SayHello_ejb/SayHello!hu.bb.SayHelloRemote";
                     //String strBean = "java:global/SayHello/SayHello_ejb/SayHello";
                     //String strBean = "hu.bb.SayHello";
                     System.out.println("lookup : " + strBean);
                     sh = (hu.bb.SayHelloRemote)ic.lookup(strBean);
                } catch (Exception e) {
                     throw new Exception("EJB lookup failure ", e);
                }
                
                // calling EJB
                String strResult = sh.sayHello("Mr. Smith");
                
                System.out.println(strResult);
                JOptionPane.showMessageDialog(null, strResult);
           }     
      }

       

      The gf-client.jar is on the classpath.

      If the GlassFish is on the same machine, the program runs correctly.
      But if the GlassFish is on the remote 192.168.0.202 machine,
      the InitialContext.lookup() does not return:

      Thread.sleep(long) line: not available [native method]     
      TcpTimeoutsImpl$1.sleepTime() line: 158     
      CorbaContactInfoListIteratorImpl.next() line: 232     
      CorbaContactInfoListIteratorImpl.next() line: 69     
      CorbaClientDelegateImpl.request(Object, String, boolean) line: 213     
      CorbaClientDelegateImpl.is_a(Object, String) line: 393     
      CORBAObjectImpl(ObjectImpl)._is_a(String) line: 112     
      NamingContextHelper.narrow(Object) line: 69     
      SerialContext$ProviderCacheKey.getNameService() line: 1241     
      SerialContext.getRemoteProvider() line: 411     
      SerialContext.getProvider() line: 347     
      SerialContext.lookup(String, int) line: 504     
      SerialContext.lookup(String) line: 455     
      InitialContext.lookup(String) line: 392     
      Main.execute() line: 28     
      Main.main(String[]) line: 11

      The VM arguments:

      -Dorg.com.CORBA.ORBInitialHost=192.168.0.202 

      Please help, I don't know what is wront.
      Thank you

       

       


       

       

       

       

       

        • 1. Re: Can't access GF3.1 remote EJBs from standalone client
          shoov

          Hi oszhatif,

          Did you find the solution for this problem?

          Vince

          • 2. Re: Can't access GF3.1 remote EJBs from standalone client
            oszhatife

            Still there is no solution.

            I tried also the official "automatic-timer" javaee 6 sample of GlassFish.

            It runs on localhost, but does not run on remote  host.

            I have a GlassFish 3.1 installed on server 192.168.1.101
            I set the remote GF 3.1 in bp-project/build.properties:
            javaee.server.name=192.168.1.101

            Now automatic-timer sample does not run:

            [java] Waiting for the timer to expire
            [java] Logged timeouts : 
            [java] org.omg.CORBA.COMM_FAILURE: FINE: IOP00410001: Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700 vmcid: OMG minor code: 1 completed: No
            [java] at sun.reflect.GeneratedConstructorAccessor30.newInstance(Unknown Source)
            [java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            [java] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            [java] at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
            [java] at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
            [java] at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
            [java] at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
            [java] at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
            [java] at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
            [java] at $Proxy26.connectFailure(Unknown Source)
            [java] at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:257)
            [java] at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:270)
            [java] at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:129)
            [java] at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:223)
            [java] at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:228)
            [java] at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:393)
            [java] at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
            [java] at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
            [java] at com.sun.enterprise.naming.impl.SerialContext$ProviderCacheKey.getNameService(SerialContext.java:1241)
            [java] at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:411)
            [java] at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:347)
            [java] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)
            [java] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
            [java] at javax.naming.InitialContext.lookup(InitialContext.java:392)
            [java] at enterprise.automatic_timer_client.AutomaticTimerJavaClient.getRecords(AutomaticTimerJavaClient.java:64)
            [java] at enterprise.automatic_timer_client.AutomaticTimerJavaClient.main(AutomaticTimerJavaClient.java:53)
            [java] Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
            [java] at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340)
            [java] at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:242)
            [java] ... 15 more
            [java] Caused by: java.net.ConnectException: Connection refused
            [java] at sun.nio.ch.Net.connect(Native Method)
            [java] at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
            [java] at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:110)
            [java] at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:325)
            [java] ... 16 more
            [java] javax.naming.NamingException: Lookup failed for 'java:global/automatic-timer-ejb/StatelessSessionBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is org.omg.CORBA.COMM_FAILURE: FINE: IOP00410001: Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700 vmcid: OMG minor code: 1 completed: No]]
            [java] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
            [java] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
            [java] at javax.naming.InitialContext.lookup(InitialContext.java:392)
            [java] at enterprise.automatic_timer_client.AutomaticTimerJavaClient.getRecords(AutomaticTimerJavaClient.java:64)
            [java] at enterprise.automatic_timer_client.AutomaticTimerJavaClient.main(AutomaticTimerJavaClient.java:53)
            [java] Caused by: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is org.omg.CORBA.COMM_FAILURE: FINE: IOP00410001: Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700 vmcid: OMG minor code: 1 completed: No]
            [java] at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:352)
            [java] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)
            [java] ... 4 more
            [java] Caused by: org.omg.CORBA.COMM_FAILURE: FINE: IOP00410001: Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700 vmcid: OMG minor code: 1 completed: No
            [java] at sun.reflect.GeneratedConstructorAccessor30.newInstance(Unknown Source)
            [java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            [java] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            [java] at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
            [java] at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
            [java] at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
            [java] at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
            [java] at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
            [java] at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
            [java] at $Proxy26.connectFailure(Unknown Source)
            [java] at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:257)
            [java] at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:270)
            [java] at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:129)
            [java] at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:223)
            [java] at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:228)
            [java] at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:393)
            [java] at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
            [java] at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
            [java] at com.sun.enterprise.naming.impl.SerialContext$ProviderCacheKey.getNameService(SerialContext.java:1241)
            [java] at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:411)
            [java] at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:347)
            [java] ... 5 more
            [java] Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
            [java] at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340)
            [java] at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:242)
            [java] ... 15 more
            [java] Caused by: java.net.ConnectException: Connection refused
            [java] at sun.nio.ch.Net.connect(Native Method)
            [java] at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
            [java] at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:110)
            [java] at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:325)
            [java] ... 16 more
            [java] Exception in thread "main" java.lang.NullPointerException
            [java] at enterprise.automatic_timer_client.AutomaticTimerJavaClient.main(AutomaticTimerJavaClient.java:54)

             

            Any help is apprecieted very much.
            Thank you.

            I also reported the problem in another thread:
            http://forums.oracle.com/forums/thread.jspa?threadID=2203656&stqc=true

             

             

             

            • 3. Re: Can't access GF3.1 remote EJBs from standalone client
              anaq

              Hi,

              I don't know if this helps, but in version 2.1.1 was a similar problem when glassfish was running on a linux system. The solution was to set the network address of IIOP Listener in gf config (in admin gui Configurations->default/server-config->ORB->IIOP listeners). Try to set the address to the network address of your server.

              Michael

              • 4. Re: Can't access GF3.1 remote EJBs from standalone client
                oszhatife

                Thank you for the help of help.Tim Quinn and Ken Cavanaugh in 

                http://java.net/jira/browse/GLASSFISH-16314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=309847#action_309847

                I followed the instructions from http://www.java.net/node/676636http://java.net/jira/images/icons/linkext7.gif

                 

                and changed "/etc/hosts" file:
                1) commented out the "internal" IP addresses in the first two lines
                2) and added a the external IP address

                127.0.0.1 localhost
                #127.0.1.1 lennyserver
                192.168.0.202 lennyserver

                     
                1. The following lines are desirable for IPv6 capable hosts
                      ::1 localhost ip6-localhost ip6-loopback
                      fe00::0 ip6-localnet
                      ff00::0 ip6-mcastprefix
                      ff02::1 ip6-allnodes
                      ff02::2 ip6-allrouters
                      ff02::3 ip6-allhosts

                Now the InitialContext.lookup() can find the bean.

                 

                 

                • 5. Re: Can't access GF3.1 remote EJBs from standalone client
                  oszhatife

                   I got solution:

                  https://forums.oracle.com/forums/message.jspa?messageID=9438964#9438964

                  I followed the instructions from http://www.java.net/node/676636
                  and changed "/etc/hosts" file:
                  1) commented out the "internal" IP addresses in the first two lines
                  2) and added a the external IP address

                  #127.0.0.1 localhost
                  #127.0.1.1 lennyserver
                  192.168.0.202 lennyserver

                  The following lines are desirable for IPv6 capable hosts
                  ::1 localhost ip6-localhost ip6-loopback
                  fe00::0 ip6-localnet
                  ff00::0 ip6-mcastprefix
                  ff02::1 ip6-allnodes
                  ff02::2 ip6-allrouters
                  ff02::3 ip6-allhosts