3 Replies Latest reply on Apr 6, 2017 10:38 AM by andey

    Binding Dynamic Remote Object in Jboss 7.1.1




      I have been trynig to bind object to Jboss 7.1.1 JNDI using the following code:


      public static void main(String[] args) {

        final Hashtable<String, Object> env = new Hashtable<String, Object>();

        env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

        env.put(Context.PROVIDER_URL, "remote://localhost:4447");

        env.put("jboss.naming.client.ejb.context", true);

        Context remoteContext = null;

        try {

         remoteContext = new InitialContext(env);


        } catch (NamingException e) {  





      Getting the following error in the client JVM:

      javax.naming.NamingException: Failed to bind [Root exception is java.io.IOException: Internal server error.]

      at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)


      In the server console I see:

      JBAS011807: Unexpected internal error: java.lang.UnsupportedOperationException: JBAS011859: Naming context is read-only

      at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:126)

      at org.jboss.as.naming.WritableServiceBasedNamingStore.bind(WritableServiceBasedNamingStore.java:56)

      at org.jboss.as.naming.NamingContext.bind(NamingContext.java:221)


      I have found several discussion on JBAS011859 but the suggested solution is to run the code inside Jboss (as EJB) or as MSC Service.


      The ability to bind object in JNDI from remote JVM was supported in Jboss 4, was this ability removed in Jboss 7? if yes, why?

      Is there a workaround?




        • 1. Re: Binding Dynamic Remote Object in Jboss 7.1.1

          We are now in the middle of migration from jboss 4.2 to jboss 7.1.1, this is a real blocker.

          I tried to use an EJB as mapping between names and Remote Objects, however this requires deep serialization of the remote object.


          Any solution for this? someone?

          • 2. Re: Binding Dynamic Remote Object in Jboss 7.1.1

            Did you ever solve this problem? I am having a similar problem in WildFly 10. David

            • 3. Re: Binding Dynamic Remote Object in Jboss 7.1.1

              The error which you mentioned like [ JBAS011859: Naming context is read-only]   you will get if you will try to bind custom objects to read only contexts


              like  "java:module" or "java:module", "java:comp" ..etc"



              InitialContext ic = new InitialContext(); 

                                   aaa.bbb.Test  test = new aaa.bbb.Test(); 

                                   ic.rebind("java:app/SomeProcess",test);     // WRONG 

                                                //  OR 

                                   ic.rebind("java:module/SomeProcess",test);        // WRONG 

                                                //  OR 

                                   ic.rebind("java:comp/SomeProcess",test);     // WRONG