5 Replies Latest reply on May 14, 2013 8:56 AM by w0203j

    JBAS011859: Naming context is read-only

    sebrevel

      Hi,


      I work on a project wich use Jersey 1.8

      We test our aplication on Glassfish 3.1 and it's work.


      Unfortunatly, we have learned yesterday that our prod environment will be JBoss

      7.1.1 final.


      When I test our app in JBoss 7.1.1, after have fixed some ClassNotFound

      excetions

      or RestEasy conflicts, I have an exception :


      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.createSubcontext(WritableSer

      vi

      ceBasedNamingStore.java:116)

              at

      org.jboss.as.naming.NamingContext.createSubcontext(NamingContext.java:338)

              at

      org.jboss.as.naming.InitialContext.createSubcontext(InitialContext.java:229)

              at

      org.jboss.as.naming.NamingContext.createSubcontext(NamingContext.java:346)

              at javax.naming.InitialContext.createSubcontext(InitialContext.java:464)

              at

      com.sun.jersey.server.impl.cdi.CDIExtension$1.stepInto(CDIExtension.java:280)


      Anyone has already use Jersey on JBoss 7 ? any ideas ?

      Thks for your help.


      Seb

        • 1. Re: JBAS011859: Naming context is read-only
          cfang

          I remember it was a workaround for some jersey/weld bug and jersey store some cdi extension object in jndi.  Not clear if that workaround is still needed on which version of jersey or weld.  The lookup name seems to be hardcoded, but you can try turning off the jndi binding/unbinding by jersey by a sysprop com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager in server JVM.

           

          The unqualified global context in GF is writable so it worked there.

          • 2. Re: JBAS011859: Naming context is read-only
            meinereiner85

            Hi all,

             

            I've got the same problem here.

             

            I've got a JBoss 7.1.1 which is currently running a RESTEasy based JAX-RS application that uses as well beans. For certain reasons I need to change from RESTEasy to Jersey.

            Unfortuantely I cannot change any settings within the JBoss itself (no access to the server).

             

            What may be a workaround for others that do have other requirements than I have is get rid of beans (also remove beans.xml) or change the JVM CDI settings.

            But what can you cannot change all those things? Is there another way in order be let Jersey add an JNDI entry in order to remove the exception mentioned above (JBAS011859: Naming context is read-only)?

             

            I guess there won't be any chance to get a fix from the Jersey team because it is perectly running in other servers.

            What can I do?

             

            meinereiner

            • 3. Re: JBAS011859: Naming context is read-only
              veeramarni84

              Meinereiner,

               

               

              Di you find any workaround? I have same issue when having beans.xml and jersey. I tried with jboss 7.1.1 and jboss 7.1.2, still same issue.

              • 4. Re: JBAS011859: Naming context is read-only
                veeramarni84

                Cheng Fang,

                 

                I added set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager=false" in the standalone.conf.bat file but that didn't fix the issue.

                • 5. Re: JBAS011859: Naming context is read-only
                  w0203j

                  Should be set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager=true"