Unable to access env-entry in java:comp namespace from a non JavaEE spawned thread in JBoss EAP 6

Solution Verified - Updated -

Issue

  • We have defined this env-entry in our war's WEB-INF/web.xml
      <env-entry>
        <env-entry-name>config/info</env-entry-name>
        <env-entry-type>java.lang.String</env-entry-type>
        <env-entry-value>someValue</env-entry-value>
      </env-entry>

And we try to look it up as shown below, but we get NameNotFoundException when we try to look it up from a Thread that was created from our war.

InitialContext ic = new InitialContext();
ic.lookup("java:comp/env/config/info");

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.