@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 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.