users@glassfish.java.net

ejb3.1, singleton and injections

From: Luca Morettoni <luca_at_morettoni.net>
Date: Wed, 17 Feb 2010 11:53:08 +0100

Hello, I have this type of application developed with NB6.8 under gfv3,
it uses two EJB:

- one ejb named "Communication", type @Singleton
- one ejb named "Actions", type @Stateless

the first one (Communication) works fine, from a ACC application I can
access it and use his methods (I use the @EJB injection in the client).
This is the declaration of Communication:

@Singleton
public class Communication implements Serializable, CommunicationLocal,
CommunicationRemote {
...


The problems come with the second beans (Actions), where I need to use
some "Communication" methos on server-side; this is the declaration of
Actions:


@Stateless
public class Actions implements actionsRemote {
      @EJB
      private Communication commEJB;
...

When I try to call any method of Actions I got this exceptions:

Caused by: javax.ejb.CreateException: Could not create stateless EJB

Caused by:
com.sun.enterprise.container.common.spi.util.InjectionException:
Exception attempting to inject Remote ejb-ref
name=Actions/commEJB,Remote 3.x interface
=Communication,ejb-link=null,lookup=null,mappedName=,jndi-name=Communication,refType=Session

into class Actions

Caused by: javax.naming.NamingException: Lookup failed for
'java:comp/env/Actions/commEJB' in SerialContext [Root exception is
javax.naming.NamingException: Exception resolving Ejb for 'Remote
ejb-ref name=Actions/commEJB,Remote 3.x interface
=Communication,ejb-link=null,lookup=null,mappedName=,jndi-name=Communication,refType=Session'

. Actual (possibly internal) Remote JNDI name used for lookup is
'Communication#Communication' [Root exception is
javax.naming.NamingException: Lookup failed for
'Communication#Communication' in SerialContext [Root exception is
javax.naming.NameNotFoundException: Communication#Communication not found]]]

Caused by: javax.naming.NamingException: Exception resolving Ejb for
'Remote ejb-ref name=Actions/commEJB,Remote 3.x interface
=Communication,ejb-link=null,lookup=null,mappedName=,jndi-name=Communication,refType=Session'

. Actual (possibly internal) Remote JNDI name used for lookup is
'Communication#Communication' [Root exception is
javax.naming.NamingException: Lookup failed for
'Communication#Communication' in SerialContext [Root exception is
javax.naming.NameNotFoundException: Communication#Communication not found]]

Caused by: javax.naming.NamingException: Lookup failed for
'Communication#Communication' in SerialContext [Root exception is
javax.naming.NameNotFoundException: Communication#Communication not found]

Caused by: javax.naming.NameNotFoundException:
Communication#Communication not found


any hints? Thanks!!!

-- 
Luca Morettoni <luca(AT)morettoni.net> | OpenSolaris SCA #OS0344
Web/BLOG: http://www.morettoni.net/ | http://twitter.com/morettoni
jugUmbria founder: https://jugUmbria.dev.java.net/
ITLOSUG leader: http://hub.opensolaris.org/bin/view/User+Group+itl-osug/