4 Replies Latest reply on Oct 29, 2014 9:05 AM by koohkan

    Stubs save in infinispan cache (map)

    koohkan

      I have now a problem.
      I habe two Clients as RMI objects. And JBoss server als middleware (EAP 3.21.)
      I generate stubs and save in map of infinispan within server  in stateless session bean.
      For remote communication from a RMI object with the other matching stubs-object is fetched from Map.
      In most cases, the communication is successful between RMI client stub and, happened over the IP and port.Aber in rare cases that port changes and gets stubs-object.
      java.rmi.ConnectException: Connection refused to host: ${IP}; nested exception is:

      Why ?

        • 1. Re: Stubs save in infinispan cache (map)
          wdfink

          There is no EAP version 3.21

          What kind of stubs you generate JBoss EJB?

          Did the invocation failed from a different host?

          Please provide a bit more informations.

          • 2. Re: Stubs save in infinispan cache (map)
            koohkan

            Sorry, it is true EAP 6.2.1.

            The following situation:

            i have a midleware based auf ejb 3.1 with stateless session beans and JPA .... My Application server is JBoss 7..x

            Midleware runs on a server.

            The clients run an other server.

            clien1 is a GUI runs within  jvm1 and client2 a standalone runs within with jvm2.

            client1 and clien2 are able to communicate, and

            client2 should be able to be called by ejb - container.

             

            For example there are 400 user. each user ist assigned client1 and client2.

            My idea:

            stub1 for client1 as remote object ,

            stub2 for client2 as remote object

            user(1) save stub1 and stub2 in ejb-container (Map infinispan: <KEY, VALUE> , <String, stub-object>)

            ....

            user(n) save stub1 and stub2 in ejb-container (Map infinispan: <KEY, VALUE> , <String, stub-object>)

            .

            client2 for a communication with the client 1, get stub from Map<String, stub>  via unique key

            .....

            often without problems,

            communication user(1): client1 communicates with stub2 ... [${IP}:${port}]...

            rarely change port and the communication fails on port

            java.rmi.ConnectionException; connection refused to host:

             

            I used in JBOSS 5.x jndi context and everything was ok.

            • 3. Re: Stubs save in infinispan cache (map)
              wdfink

              With EAP6 the behavior has changed.

              The Proxy/Stub is 'only' a implementation of the interface which use the ejb-client context.

              So it is possible to serialize it.

              But the real invocation is based on the client environment. How you create and use it at client side? How the code look like?

              • 4. Re: Stubs save in infinispan cache (map)
                koohkan

                public class Client2Impl implements Client2
                {
                public void bind (Object exportObject, String bindName)
                {
                  // Interface von Remote Session Bean stateless within EJB Container (Server)
                   jecService.bind (bindName, UnicastRemoteObject.exportObject ((Client) exportObject, 0));
                }

                 

                 

                 

                public static void main (String[] args)

                {

                     ..........

                }

                 

                .....

                }

                ----------
                public interface Client2 extends Remote
                {
                registrereClient1(Client c, String bindName) throws RemoteException ;
                .....
                }
                +++++++++++++++++++++++++++++++++++++
                public class Client1Impl implements Client1
                {

                 

                     public static void main (String[] args)

                     {

                          ...

                     }

                    
                    public void doWhat (onJecEventOcurred event)  throws RemoteException
                    {
                     ...... 
                    }


                }

                public interface Client1 extends Remote, EventListener
                {

                void doWhat (java.util.EventObject evtent) throws RemoteException;
                ....

                }
                +++++++++++++++++++++++++++++++++++++

                have very simplified and renamed but technically is the way it is

                when the server is restarted is one to two days without fail.

                 

                Cache eithin EJB Container as infinispan cache:

                Cache <String, Object>

                 

                User1: save in cache: <"user1Clien1",  stubClient1>

                                                   and

                                              <"user1Clien2", stubClient2>

                ----

                User2: save in cache: <"user2Clien1",  stubClient1>

                                                   and

                                              <"user2Clien2",  stubClient2>

                ----

                User3: save in cache: <"user3Clien1",  stubClient1>

                                                   and

                                              <"user3Clien2",  stubClient2>

                ----

                ...

                User(n): save in cache: <"user(n)Clien1",  stubClient1>

                                                   and

                                              <"user(n)Clien2",  stubClient2>