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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content