JBoss Community

Re: Using ejb-jar.xml for @Singleton bean

created by jaikiran pai in EJB3 - View the full discussion

This looks like a bug. Can you try removing that @EJB(name = "ejb/VersionManager") altogether from the code and you this new ejb-jar.xml instead:

 

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
    version="3.1">

    <enterprise-beans>
        <session>
            <ejb-name>StartupBean</ejb-name>
            <ejb-class>com.example.services.startup.StartupBean</ejb-class>
            <ejb-local-ref>
                <ejb-ref-name>ejb/VersionManager</ejb-ref-name>
                <local>com.example.services.version.VersionManager</local>
                <injection-target>
                    <injection-target-class>com.example.services.startup.StartupBean</injection-target-class>
                    <injection-target-name>versionManager</injection-target-name>
                </injection-target>

                <lookup-name>01-services/VersionManagerBean/local</lookup-name>
            </ejb-local-ref>
        </session>
    </enterprise-beans>

</ejb-jar>

 

Note that I have added the injection-target element in the ejb-jar.xml, to do the injection. See if that works.

Reply to this message by going to Community

Start a new discussion in EJB3 at Community