users@glassfish.java.net

Problem with EJB Injection within an interceptor

From: Dipl.-Ing. Torsten Liermann <lier_at_liermann-it.de>
Date: Thu, 10 Nov 2011 16:04:06 +0200

Hi,

implemented an interceptor with one EJB injection like

@Interceptor
public class CriticalServerModeInterceptor {
        
        @EJB
        SynchronizationStatusBean synchronizationStatusBean;
        
        ......
        ......
    }
}

On enjecting the EJB the jndi lookup goes failed with an
EJB not found exception:

  javax.naming.NameNotFoundException: No object bound to name java:comp/env/de.zeiss.lehel.interceptors.CriticalServerModeInterceptor/synchronizationStatusBean

  The "CDI" used the lookup URL
java:comp/env/de.zeiss.lehel.interceptors.CriticalServerModeInterceptor/synchronizationStatusBean

But the EJB is registered as java:global/FORUM/ArchiveServer/SynchronizationStatusBean

The glassfish server.log shows for bean registration:

  [#|2011-11-10T12:41:30.820+0100|INFO|glassfish3.1.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=17;_ThreadName=Thread-2;|Portable JNDI names for EJB SynchronizationStatusBean :
[java:global/FORUM/ArchiveServer/SynchronizationStatusBean, java:global/XYZ/ArchiveServer/SynchronizationStatusBean!de.zeiss.lehel.service.archivemgr.SynchronizationStatusBean]|#]

What is wrong in our setup?

Thanks for a hint.
Torsten