[jboss-jira] [JBoss JIRA] (AS7-4240) NameNotFoundException thrown when trying to read java:*/env context in Servlet container.
Robert Edgecombe (JIRA)
jira-events at lists.jboss.org
Wed Mar 21 01:48:47 EDT 2012
[ https://issues.jboss.org/browse/AS7-4240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678205#comment-12678205 ]
Robert Edgecombe commented on AS7-4240:
---------------------------------------
I don't know whether this is relevant?
The following code:
Context context = new InitialContext();
Context moduleContext = (Context) context.lookup("java:module");
Object lookup = moduleContext.lookup("env/GREETING_TEXT");
throws the following:
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) javax.naming.NameNotFoundException: env/GREETING_TEXT -- service jboss.naming.context.java.module.jboss-as-helloworld-ear.jboss-as-helloworld.env.GREETING_TEXT
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jboss.as.quickstarts.helloworld.HelloWorldServlet.doGet(HelloWorldServlet.java:57)
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[Server:server-one]
[Server:server-one] 16:09:45,023 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[Server:server-one]
[Server:server-one] 16:09:45,039 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[Server:server-one]
[Server:server-one] 16:09:45,039 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[Server:server-one]
[Server:server-one] 16:09:45,039 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
[Server:server-one]
[Server:server-one] 16:09:45,054 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[Server:server-one]
[Server:server-one] 16:09:45,054 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[Server:server-one]
[Server:server-one] 16:09:45,054 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[Server:server-one]
[Server:server-one] 16:09:45,054 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
[Server:server-one]
[Server:server-one] 16:09:45,054 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[Server:server-one]
[Server:server-one] 16:09:45,054 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
[Server:server-one]
[Server:server-one] 16:09:45,054 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
[Server:server-one]
[Server:server-one] 16:09:45,054 ERROR [stderr] (http--127.0.0.1-8080-1) at java.lang.Thread.run(Unknown Source)
[Server:server-one]
Which has a different service name than would be indicated by the list on "java:comp/env"
jboss.naming.context.java.module.jboss-as-helloworld-ear.jboss-as-helloworld.env.GREETING_TEXT
vs
[Server:server-one] 16:09:45,148 ERROR [stderr] (http--127.0.0.1-8080-1) javax.naming.NameNotFoundException: naming/context/java/modulejboss.naming.context.java.module.jboss-as-helloworld-ear.jboss-as-helloworld.naming.context.java.module.jboss-as-helloworld-ear.jboss-as-helloworld.env
> NameNotFoundException thrown when trying to read java:*/env context in Servlet container.
> -----------------------------------------------------------------------------------------
>
> Key: AS7-4240
> URL: https://issues.jboss.org/browse/AS7-4240
> Project: Application Server 7
> Issue Type: Bug
> Components: Naming
> Affects Versions: 7.1.1.Final
> Environment: Windows7 Enterprise x64
> Intel Core 2 Duo
> Oracle Java jdk1.6.0_29
> Reporter: Robert Edgecombe
> Assignee: Stuart Douglas
> Fix For: 7.1.2.Final
>
>
> We have many J2EE 1.4 apps that need to be migrated from Oracle Application Server
> These applications rely on configuration using Environment Entries
> Most of the answers to issues I have read indicate that this is done using jboss-web.xml but this is not an acceptable solutin as it requires repackaging of the deployment artifact for different servers and different environments and is therefor contrary to the spirit (and I believe the letter) of the JavaEE spec.
> The documentation on this capability is either hidden or missing.
> I was tasked with working out how to use the JBOSS tools to configure these values and have been unable to do so.
> I modified the quickstart helloworld example to accept a value using the @Resource annotation and attempted to set this value using jboss-cli.
> After several attempts to guess how to do this I modified the servlet to walk down the context tree.
> This servlet throws a NameNotFoundException when trying to list the bindings at:
> * java:comp/env
> * java:app/env
> * java:module/env
> I have written the servlet to perform this walk in the following contexts:
> * Ithe initial context
> * java:
> * java:jboss
> * java:comp
> * java:module
> * java:app
> * java:global
> java:global seems to be able to accept values added using jboss-cli (not surprising)
> java:comp, java:module and java:app seem to return some of the expected values (eg ModuleName and AppName) but throw the exception when trying to list entries under */env
> The initial context and java: seem to display the entries added through jboss-cli
> Adding a Deployment descriptor (web.xml), that provides values for these entries, results in no entries that are visible through jboss-cli or any of the contexts listed in the servlet.
> I then ran the following command through jboss-cli and restarted the app
> /profile=full/subsystem=naming/binding=\/java\:app\/jboss-as-helloworld-ear\/env\/GREETING_TEXT:add(binding-type="simple",value="RE")
> This resulted in the same NameNotFoundException being thrown at java:app/env when walking the initial context as has been thrown all along when listing env in java:app
> It also resulted in java:app appearing in the java: context but being empty.
> Prior to running the add command, java:app did not appear in the initial context or java: context at all.
> I then ran the following command through jboss-cli and restarted the app
> /profile=full/subsystem=naming/binding=\/java\:module\/jboss-as-helloworld-ear\/jboss-as-helloworld\/env\/GREETING_TEXT:add(binding-type="simple",value="SJM")
> This resulted in the same NameNotFoundException being thrown at java:module/env when walking the initial context as has been thrown all along when listing env in java:module
> It also resulted in java:module appearing in the java: context but being empty.
> Prior to running the add command, java:module did not appear in the initial context or java: context at all.
> My conclusion is that my commands in jboss-cli may be the appropriate ones to add the correct entries but that the servlet cannot reach the java:module/env or java:app/env contexts that should be available to it according to the javaEE6 spec.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list