Search code examples
jakarta-eetomcatjndi

What could cause "javax.naming.OperationNotSupportedException" when tomcat startup


My tomcat(7.0.34) shows error as

Creation of the naming context failed: javax.naming.OperationNotSupportedException: Context is read only

when it starts up. But I don't know why? And how to fix it?

UPDATE

the log:

Info: Starting Servlet Engine: Apache Tomcat/7.0.34
Mar 11, 2013 9:43:18 PM org.apache.catalina.core.NamingContextListener lifecycleEvent
Critical: Creation of the naming context failed: javax.naming.OperationNotSupportedException: Context is read only
Mar 11, 2013 9:43:18 PM org.apache.coyote.AbstractProtocol start
Info: Starting ProtocolHandler ["ajp-bio-8081"]
Mar 11, 2013 9:43:18 PM org.apache.catalina.core.StandardService startInternal
Info: Starting service ChongWuXingQiu
Mar 11, 2013 9:43:18 PM org.apache.catalina.core.StandardEngine startInternal
Info: Starting Servlet Engine: Apache Tomcat/7.0.34
Mar 11, 2013 9:43:18 PM org.apache.catalina.core.NamingContextListener lifecycleEvent
Critical: Creation of the naming context failed: javax.naming.OperationNotSupportedException: Context is read only
Mar 11, 2013 9:43:18 PM org.apache.coyote.AbstractProtocol start
Info: Starting ProtocolHandler ["ajp-bio-8082"]
Mar 11, 2013 9:43:18 PM org.apache.catalina.startup.Catalina start
Info: Server startup in 1753 ms

Solution

  • The Java EE spec states in Section 5.3.4 that the Naming context must be read-only and that OperationNotSupportedExceptions must be thrown on change requests. Unfortunatly, this does not directly answer your question, but may be a hint

    Quote from the spec:

    The container must ensure that the application component instances have only read access to their naming context. The container must throw the javax.naming.OperationNotSupportedException from all the methods of the javax.naming.Context interface that modify the environment naming context and its subcontexts.