java.lang.ClassNotFoundException: org.hibernate.ejb.EntityManagerImpl This makes no sense to me, however. This class is found in hibernate-entitymanager.jar, which is present in the root of the .ear file containing the application. Also, this class is needed for anything in the application to work -- and everything does work. Does anyone know why this might be happening? Below see a partial listing of ShoppingCartBean.java, followed by the relevant section from server.log. [b]Partial ShoppingCartBean.java[/b] [code] @Stateful @Scope(ScopeType.SESSION) @Name("shoppingCartBean") public class ShoppingCartBean implements com.unclejoes.ejb.ShoppingCartLocal { @In(create = true, required = false) protected transient FacesMessages facesMessages; private enum ShoppingStatus {SHOP, CHECKOUT, ORDER_CONFIRMATION, AUTH_COMPLETED}; private ShoppingStatus shoppingStatus = ShoppingStatus.SHOP; private Result ccResult = null; /** Used for the user to select whether the payment address is the same or * different from the shipping address. */ private enum AddressOption { sameAsShipAddress, differentFromShipAddress }; private AddressOption addressOption = AddressOption.sameAsShipAddress; @PersistenceContext(type=PersistenceContextType.EXTENDED) EntityManager em; @EJB private UtilityLocal _utilityFacade; //(scope=ScopeType.SESSION) @Out Order cartOrder = new Order(); // This variable is used to store a successful order for use in print screen. @Out(scope=ScopeType.SESSION) Order previousCartOrder = new Order(); //@In(create=true) //@Out(scope=ScopeType.CONVERSATION) @Out(scope=ScopeType.SESSION) private User user = new User(); //@Out(scope=ScopeType.CONVERSATION) @Out(scope=ScopeType.SESSION) private CreditCard creditCard = new CreditCard(); @In private Locale locale; /** Creates a new instance of ShoppingCartBean */ public ShoppingCartBean() { } ... [/code] [b]Extract from server.log[/b] [#|2007-09-26T20:24:24.881-0500|SEVERE|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=29;_Thr eadName=ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[]];90 7f0100001f-43590adc-49e;_RequestID=5499b02d-6e8b-48f9-a5ff-071750e77915;|EJB5128:Error during Stateful Session Bean activation for key [907f0100001f-43590adc-49e]|#] [#|2007-09-26T20:24:24.881-0500|SEVERE|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=29;_Thr eadName=ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[]];_R equestID=5499b02d-6e8b-48f9-a5ff-071750e77915;|sfsb activation error. Key: 907f0100001f-43590adc-49e javax.ejb.EJBException: Couldn't create EntityManager for refName: com.unclejoes.ejb.ShoppingCartBean/em at com.sun.ejb.containers.StatefulSessionContainer.repopulateEEMMapsInContext(StatefulSessionContainer. java:2141)

Oracle Community | rickhoro | 10 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Need help - stateful session bean activation failing

    Oracle Community | 10 years ago | rickhoro
    java.lang.ClassNotFoundException: org.hibernate.ejb.EntityManagerImpl This makes no sense to me, however. This class is found in hibernate-entitymanager.jar, which is present in the root of the .ear file containing the application. Also, this class is needed for anything in the application to work -- and everything does work. Does anyone know why this might be happening? Below see a partial listing of ShoppingCartBean.java, followed by the relevant section from server.log. [b]Partial ShoppingCartBean.java[/b] [code] @Stateful @Scope(ScopeType.SESSION) @Name("shoppingCartBean") public class ShoppingCartBean implements com.unclejoes.ejb.ShoppingCartLocal { @In(create = true, required = false) protected transient FacesMessages facesMessages; private enum ShoppingStatus {SHOP, CHECKOUT, ORDER_CONFIRMATION, AUTH_COMPLETED}; private ShoppingStatus shoppingStatus = ShoppingStatus.SHOP; private Result ccResult = null; /** Used for the user to select whether the payment address is the same or * different from the shipping address. */ private enum AddressOption { sameAsShipAddress, differentFromShipAddress }; private AddressOption addressOption = AddressOption.sameAsShipAddress; @PersistenceContext(type=PersistenceContextType.EXTENDED) EntityManager em; @EJB private UtilityLocal _utilityFacade; //(scope=ScopeType.SESSION) @Out Order cartOrder = new Order(); // This variable is used to store a successful order for use in print screen. @Out(scope=ScopeType.SESSION) Order previousCartOrder = new Order(); //@In(create=true) //@Out(scope=ScopeType.CONVERSATION) @Out(scope=ScopeType.SESSION) private User user = new User(); //@Out(scope=ScopeType.CONVERSATION) @Out(scope=ScopeType.SESSION) private CreditCard creditCard = new CreditCard(); @In private Locale locale; /** Creates a new instance of ShoppingCartBean */ public ShoppingCartBean() { } ... [/code] [b]Extract from server.log[/b] [#|2007-09-26T20:24:24.881-0500|SEVERE|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=29;_Thr eadName=ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[]];90 7f0100001f-43590adc-49e;_RequestID=5499b02d-6e8b-48f9-a5ff-071750e77915;|EJB5128:Error during Stateful Session Bean activation for key [907f0100001f-43590adc-49e]|#] [#|2007-09-26T20:24:24.881-0500|SEVERE|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=29;_Thr eadName=ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[]];_R equestID=5499b02d-6e8b-48f9-a5ff-071750e77915;|sfsb activation error. Key: 907f0100001f-43590adc-49e javax.ejb.EJBException: Couldn't create EntityManager for refName: com.unclejoes.ejb.ShoppingCartBean/em at com.sun.ejb.containers.StatefulSessionContainer.repopulateEEMMapsInContext(StatefulSessionContainer. java:2141)

    Root Cause Analysis

    1. java.lang.ClassNotFoundException

      org.hibernate.ejb.EntityManagerImpl This makes no sense to me, however. This class is found in hibernate-entitymanager.jar, which is present in the root of the .ear file containing the application. Also, this class is needed for anything in the application to work -- and everything does work. Does anyone know why this might be happening? Below see a partial listing of ShoppingCartBean.java, followed by the relevant section from server.log. [b]Partial ShoppingCartBean.java[/b] [code] @Stateful @Scope(ScopeType.SESSION) @Name("shoppingCartBean") public class ShoppingCartBean implements com.unclejoes.ejb.ShoppingCartLocal { @In(create = true, required = false) protected transient FacesMessages facesMessages; private enum ShoppingStatus {SHOP, CHECKOUT, ORDER_CONFIRMATION, AUTH_COMPLETED}; private ShoppingStatus shoppingStatus = ShoppingStatus.SHOP; private Result ccResult = null; /** Used for the user to select whether the payment address is the same or * different from the shipping address. */ private enum AddressOption { sameAsShipAddress, differentFromShipAddress }; private AddressOption addressOption = AddressOption.sameAsShipAddress; @PersistenceContext(type=PersistenceContextType.EXTENDED) EntityManager em; @EJB private UtilityLocal _utilityFacade; //(scope=ScopeType.SESSION) @Out Order cartOrder = new Order(); // This variable is used to store a successful order for use in print screen. @Out(scope=ScopeType.SESSION) Order previousCartOrder = new Order(); //@In(create=true) //@Out(scope=ScopeType.CONVERSATION) @Out(scope=ScopeType.SESSION) private User user = new User(); //@Out(scope=ScopeType.CONVERSATION) @Out(scope=ScopeType.SESSION) private CreditCard creditCard = new CreditCard(); @In private Locale locale; /** Creates a new instance of ShoppingCartBean */ public ShoppingCartBean() { } ... [/code] [b]Extract from server.log[/b] [#|2007-09-26T20:24:24.881-0500|SEVERE|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=29;_Thr eadName=ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[]];90 7f0100001f-43590adc-49e;_RequestID=5499b02d-6e8b-48f9-a5ff-071750e77915;|EJB5128:Error during Stateful Session Bean activation for key [907f0100001f-43590adc-49e]|#] [#|2007-09-26T20:24:24.881-0500|SEVERE|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=29;_Thr eadName=ContainerBackgroundProcessor[StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[]];_R equestID=5499b02d-6e8b-48f9-a5ff-071750e77915;|sfsb activation error. Key: 907f0100001f-43590adc-49e javax.ejb.EJBException: Couldn't create EntityManager for refName: com.unclejoes.ejb.ShoppingCartBean/em at com.sun.ejb.containers.StatefulSessionContainer.repopulateEEMMapsInContext(StatefulSessionContainer. java:2141)

      at com.sun.ejb.containers.StatefulSessionContainer.activateEJB()
    2. Embedded GlassFish Web
      BaseContainer.preInvoke
      1. com.sun.ejb.containers.StatefulSessionContainer.activateEJB(StatefulSessionContainer.java:2040)
      2. com.sun.ejb.containers.util.cache.LruSessionCache.lookupEJB(LruSessionCache.java:281)
      3. com.sun.ejb.containers.StatefulSessionContainer._getContext(StatefulSessionContainer.java:1211)
      4. com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1675)
      5. com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1229)
      5 frames