1 Reply Latest reply: Feb 1, 2012 2:48 AM by jaikiran pai RSS

JNDI binding in extension module READONLY exception

Jeff Yu Master

This is a cross thread from JNDI forum, but thought it is best asked in the AS7 forum, as it is under AS7. (https://community.jboss.org/message/645537#645537), I am now facing the same problem.


Below is the quote from hellen-z




My component is deployed as an extension module. And I cannot use EJB annotation for resource injection since only web profile can be used.


So I try to do binding calling


     new InitialContext().bind(....),


and I got excetion


     JBAS011859: Naming context is read-only: java.lang.UnsupportedOperationException: JBAS011859: Naming context is read-only

       at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:118) [jboss-as-naming-7.1.0.CR1.jar:7.1.0.CR1]

        at org.jboss.as.naming.WritableServiceBasedNamingStore.bind(WritableServiceBasedNamingStore.java:53) [jboss-as-naming-7.1.0.CR1.jar:7.1.0.CR1]

        at org.jboss.as.naming.NamingContext.bind(NamingContext.java:220) [jboss-as-naming-7.1.0.CR1.jar:7.1.0.CR1]

        at org.jboss.as.naming.InitialContext.bind(InitialContext.java:146) [jboss-as-naming-7.1.0.CR1.jar:7.1.0.CR1]

        at org.jboss.as.naming.NamingContext.bind(NamingContext.java:229) [jboss-as-naming-7.1.0.CR1.jar:7.1.0.CR1]


Result is the same if I use either org.jboss.as.naming.InitialContext or javax.naming.InitialContext


Could you give any suggestions what I need to to?


Thanks very much!




By invoking this before binding, the binding works




But I'm not sure if it's the good way to do it.