Skip to main content

Injecting Remote EJB in to MDB

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
whartung
Offline
Joined: 2003-06-13

I have a legacy, EJB 2 application that is deployed on GF v3. All of the beans are Remote.I am adding a new MDB to it, and trying to inject one of the existing Session Bean in to the MDB.
The ejb-jar.xml entry for the Session Bean looks like this:

        <session>
            <ejb-name>ProfileSession</ejb-name>
            <mapped-name>ProfileSession</mapped-name>

            <home>com.example.ecms.as.ProfileSessionHome</home>
            <remote>com.example.ecms.as.ProfileSession</remote>
            <ejb-class>com.example.ecms.as.ProfileSessionEJB</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
        </session>

In my MDB, I have this:

@EJB(name = "ejb/ProfileSession", beanInterface=ProfileSessionHome.class, beanName = "ProfileSession")

The exception I am getting when the MDB is created is:

com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-refname=ejb/ProfileSession,Remote 2.x home=com.example.ecms.as.ProfileSessionHome,Remote 2.x component
interface=com.example.ecms.as.ProfileSession resolved to intra-app
EJB ProfileSession in module
AppServerCode.jar,ejb-link=ProfileSession,lookup=,mappedName=,jndi-name=ProfileSession,refType=Session
into class com.example.ecms.as.ExampleMDB: Can not set
com.example.ecms.as.ProfileSession field
com.example.ecms.as.ExampleMDB.psb to
com.example.ecms.as._ProfileSessionHome_DynamicStub

Both the Session Bean and MDB are deployed within the same EAR artifact.

Any insight to this would be appreciated.