Dependency Injection across apps fails - Websphere

This is a discussion on Dependency Injection across apps fails - Websphere ; I have defined in one EAR the following bean, which I would like to call {code} @Stateless @EJB(name="SystemActivityMonitor", beanInterface=SystemActivityMonitorLocal.class, beanName="SystemActivityMonitorBean") public class SystemActivityMonitorBean implements SystemActivityMonitorLocal { {code} In another EAR I define {code} @EJB(name="SystemActivityMonitorBean") private SystemActivityMonitorLocal systemActivityMonitor ; {code} with ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Dependency Injection across apps fails

  1. Dependency Injection across apps fails

    I have defined in one EAR the following bean, which I would like to call

    {code}
    @Stateless
    @EJB(name="SystemActivityMonitor",
    beanInterface=SystemActivityMonitorLocal.class,
    beanName="SystemActivityMonitorBean")
    public class SystemActivityMonitorBean implements SystemActivityMonitorLocal {
    {code}


    In another EAR I define

    {code}
    @EJB(name="SystemActivityMonitorBean")
    private SystemActivityMonitorLocal systemActivityMonitor ;
    {code}


    with the following ibm-ejb-jar-bnd file attached:

    {code}

    {code}


    When the called module is loaded, the console displays the following :

    {code}
    [30.07.09 07:15:21:723 CEST] 0000000f EJBContainerI I CNTR0167I: Der Server bindet die Schnittstelle iaas.swom.sharedejbs.systemActivityMonitor.SystemA ctivityMonitorLocal der Enterprise-Bean SystemActivityMonitorBean im Modul SharedEJBs.jar der Anwendung SWoMV1. Bindungsposition: ejblocal:iaas.swom.sharedejbs.systemActivityMonito r.SystemActivityMonitorLocal
    {code}


    For the calling module, the following is displayed:

    {code}
    [30.07.09 07:15:22:483 CEST] 0000000e InjectionProc W CWNEN0040W: Das Feld oder die Methode SeqAssignRRSeqAssignRRBindingPort.systemActivityMo nitor wurde für mehrere Injektionsziele konfiguriert.
    {code}


    When I run the calling module, I get the error message

    {code}
    [30.07.09 07:15:44:621 CEST] 0000001e EJBInjectionB E CWNEN0030E: Beim Abrufen der Objektinstanz des Bindungsobjekts Reference:iaas.swom.sharedejbs.systemActivityMonit or.SystemActivityMonitorLocal ist bei der Factory com.ibm.ws.ejbcontainer.injection.factory.EJBLinkO bjectFactory ein Fehler aufgetreten.
    {code}


    I hope it's not a problem that the error messages are displayed in German. I appreciate any help.

    dieter

  2. Re: Dependency Injection across apps fails

    Hi Dieter,

    Sorry for the delayed response. I'm not sure that you need the @EJB annotation on the SystemActivityMonitorBean class.

    The warning indicates that the SeqAssignRRSeqAssignRRBindingPort.systemActivityMo nitor field is configured to be injected at least twice. This is the most likely culprit.

    There should be an FFDC file generated (in the PROFILE_ROOT/logs/ffdc directory) when the CWNEN0030E error message is printed. It should contain the text "getInjectionObject" and "516". Can you post the contents of this file?
    The exception and stack trace are the most useful pieces of information, but some of the parameter data may also be helpful.

    Hope this helps,

    Andy

  3. Re: Dependency Injection across apps fails

    Good morning Andy,

    thank you for all your help. I have removed the @EJB annotation on the SystemActivityMonitorBean with no evident change. As request, I have attached the FFDC file.

    dieter

  4. Re: Dependency Injection across apps fails

    Hi Dieter,

    It looks like you binding is being ignored - the EJB Container is attempting to inject the bean using EJBLink which only has visibility to the application. EJBLink is only used when the container cannot find a proper binding for the injection target.

    Looking at the ["bindings bible" page in the infocenter|http://publib.boulder.ibm.com/infoce...ngsejbfp.html], I think the problem may be in the name of the ejb-ref element.

    Have you tried the following:
    {code}
    ejb-ref name="
    {code}

    The idea here is that the second app/EJB module (containing the SeqAssignRRSeqAssignRRBindingPort bean) must specify the location of the ejb-ref (in this case it is SeqAssignRRSeqAssignRRBindingPort/systemActivityMonitor) in the name attribute, and the JNDI lookup to map it to in the binding-name attribute.
    Also, this assumes that you are using the default binding location for SystemActivityMonitorBean in the first app/EJB module. If you specified a simple-binding-name for the SystemActivityMonitorBean, then you must change the binding-name attribute to match it.

    Here's hoping for better results...

    Andy

+ Reply to Thread