@Resource injection of env-entry is not working in JBoss EAP 6

Solution Unverified - Updated -

Issue

  • We have a singleton startup EJB which is setup to initialize with an "env-entry" in ejb-jar.xml using @Resouce(name="name"). But this variable is not getting initialized and we are getting "null" as the value during runtime.

The ejb-jar-xml has:

        ...
        <session>
            <ejb-name>ExampleBean</ejb-name>
            <session-type>Singleton</session-type>
            <env-entry>
                <env-entry-name>example</env-entry-name>
                <env-entry-type>java.lang.String</env-entry-type>
                <env-entry-value>value</env-entry-value>
            </env-entry>
        </session>
        ...

The Singleton looks like:

@Startup
@Singleton
public class ExampleBean {
    @Resource (name = "example")
    private String example;
}

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