1 Reply Latest reply on Mar 19, 2007 10:16 PM by Kahli Burke

    Inject Session Bean Into a POJO

    Tom Goring Apprentice


      I'm trying to set up a simple Seam Bean to be injected with a Session bean.

      POJO bean:

      public class UserMenuManager {
       @In(value="UserManagerBean", create=true)
       private UserManager userManager;

      EJB3 Session Bean defined as
      public class UserManagerBean implements UserManager {

      Caused by: javax.naming.NameNotFoundException: UserManagerBean not bound
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
       at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)

      What am I doing wrong ?

      Thanks in advance !

        • 1. Re: Inject Session Bean Into a POJO
          Kahli Burke Newbie

          Seam is trying to create your session component by looking up the bean in JNDI.

          Seam will try to use a pattern for the name as specified by the jndi-name initialization parameter. This is usually something like myEarName/#{ejbName}/local. So, seam will use the name of your component as specified by @Name.

          Look at sec 19.1.2 in the reference docs as well as 20.1 for information on the @JndiName annotation that you should use.