4 Replies Latest reply on Jul 9, 2009 2:20 AM by charlymch

    Problem accessing EJB Statefull Session Bean

    charlymch

      Hi guys,
              I'm having a problem, I think it may be something that I'm missing, but I honestly don't know what it is. I have a Statefull Session Bean, bound to the Application Scope as follows:


      @Name("cvManager")
      @Scope(ScopeType.APPLICATION)
      @Stateful
      @AutoCreate
      public class CommonValueManager implements Serializable, CommonValueCacheProvider



      then I'm trying to access this bean by either of this two methods:


      CommonValueCacheProvider cvManager;
                
      cvManager = ( (CommonValueCacheProvider) Component.getInstance("cvManager") );



      Or


      @In(required=false,create=true)
      private CommonValueCacheProvider cvManager;



      and I get the following exception, at least in the second case:


      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: cvManager
           at org.jboss.seam.Component.newInstance(Component.java:2106)
           at org.jboss.seam.Component.getInstance(Component.java:1988)
           at org.jboss.seam.Component.getInstance(Component.java:1950)
           at org.jboss.seam.Component.getInstance(Component.java:1944)
           at org.jboss.seam.Component.getInstance(Component.java:1939)
           at org.seamtrial.entity.Product.setProductCategory(Product.java:97)
           at org.seamtrial.entity.Product.setCategoryCode(Product.java:91)
           ... 110 more
      Caused by: javax.naming.NameNotFoundException: seamTrial\CommonValueManager\local not bound
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
           at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
           at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
           at javax.naming.InitialContext.lookup(InitialContext.java:392)
           at org.jboss.seam.Component.instantiateSessionBean(Component.java:1367)
           at org.jboss.seam.Component.instantiate(Component.java:1331)
           at org.jboss.seam.Component.newInstance(Component.java:2084)
           ... 116 more



      my component configuration has the following parameters, in case the JNDI name strikes you as odd:


      <core:init debug="true" jndi-pattern="seamTrial\#{ejbName}\local" precedence="100"/>



      Any help will be great,


      thanks