3 Replies Latest reply on Aug 13, 2012 4:58 AM by qtm Branched from an earlier discussion.

    EJB remote access from a server instance - dynamic destinations

    qtm

      Hello,

       

      I'm testing using 7.1.1., so if my following points have been updated, please correct me.

       

      I'd like to ask a few more questions about ejb access:

       

      - Is there any way I could do the invocation in a dynamic way? I don't know the remote servers until runtime. It would be great to configure everything dynamically, so I won't have to change my client "standalone.xml". Since my remote servers are given at runtime, what should I do ? - configure hundreds of servers there just to be sure that I won't miss anything?

       

      - Could the invoking of a remote bean from a remote client and a server be the same(with no modifications on my side)? Sometimes I need to move my code from a remote client to a bean, so I will be forced to make some modifications.

       

      - Now in my client I can't use the context to lookup a bean and a remote connection factory (both located on the remote server). Now I have :

              final Properties env1 = new Properties();

              env1.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

             

              Properties env2 = new Properties();

              env2.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName());       

              env2.put(Context.PROVIDER_URL, "remote://[my_ip]:4448");       

              env2.put(Context.SECURITY_PRINCIPAL, "test");

              env2.put(Context.SECURITY_CREDENTIALS, "test1");

                     

           

              final Context ctx = new InitialContext(env1);

              final Context ctx2 = new InitialContext(env2); 

              Queue q = (Queue)ctx2.lookup("jms/queue/test");       

              ConnectionFactory factory = (ConnectionFactory)ctx2.lookup("/jms/RemoteConnectionFactory");

       

              IEJCFTest obj = (IEJCFTest)    ctx.lookup("ejb:TestEJBEAR/TestEJB/EJBCFTest!test.IEJCFTest");       

              obj.executeTest();

       

             It would help very much to be able to have just a context for the remote server and do everything with it.

       

      Regards