4 Replies Latest reply on Dec 9, 2014 6:51 AM by andilog

    Programmatically configure ejb client properties jboss 7.1.1

    surajchhetry

      Hi all,

        We can use either jndi.properties file or can pass jndi configuration value through InitialContext constructor using HashMap. I want to configure ejb client programmetically instead of using jboss-ejb-clinet.properties is that possible in Jboss 7.1.1 ?

        • 1. Re: Programmatically configure ejb client properties jboss 7.1.1
          jaikiran

          suraj chhetry wrote:

           

          I want to configure ejb client programmetically instead of using jboss-ejb-clinet.properties is that possible in Jboss 7.1.1 ?

          Using JBoss EJB client APIs? Yes, that's possible. If you tell us more about what you are trying to do then I can point you to some testcases where a similar thing is done.

          • 2. Re: Programmatically configure ejb client properties jboss 7.1.1
            jaysensharma

            Hi Suraj,

             

                      Try using "EJBClientConfiguration" to avoid using the "jboss-ejb-clinet.properties"

             

            Properties clientProp = new Properties();

            clientProp.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");

            clientProp.put("remote.connections", "default");

            clientProp.put("remote.connection.default.port", "4447");

            clientProp.put("remote.connection.default.host", "localhost");

            clientProp.put("remote.connection.default.username", "ejbUser");

            clientProp.put("remote.connection.default.password", "ejbPassword");

            clientProp.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");

             

            EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(p);

            ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);

            EJBClientContext.setSelector(selector);

             

            Properties props = new Properties();

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

            Context ctx = new InitialContext(props);

            • 3. Re: Programmatically configure ejb client properties jboss 7.1.1
              surajchhetry

              Dear JaiKiran,

                I just want to configure ejb client properties at runtime so that based on some condition I can change Remote connection URL.

               

              Dear Jay,

                 Thank you for your soution that what I was looking for.

               

               

              Thank you guys for helping me.

              • 4. Re: Programmatically configure ejb client properties jboss 7.1.1
                andilog

                Thank you Jay Kumar SenSharma.

                Could not find this somewhere else.

                Very helpful!