users@glassfish.java.net

JPA not working with EJB3

From: <glassfish_at_javadesktop.org>
Date: Tue, 30 Jun 2009 18:50:41 PDT

I have the following code in my ejb

[code]
@Stateless
public class UserServiceBean implements UserService {

    /**
     * Default constructor.
     */
    public UserServiceBean() {
        // TODO Auto-generated constructor stub
    }

        @Override
        public User create(User user) {
                EntityManagerFactory emf = Persistence.createEntityManagerFactory("workingpoint-model");
                EntityManager em = emf.createEntityManager();
                
                em.getTransaction().begin();
                
                em.persist(user);
                
                em.getTransaction().commit();
                
                em.close();
                
                return user;
        }

}
[/code]

i am getting,

[code]
javax.persistence.PersistenceException: No Persistence provider for EntityManager named workingpoint-model
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:96)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:66)
        at com.wp.dal.service.UserServiceBean.create(UserServiceBean.java:25)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1018)
        at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1090)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:3846)
        at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5005)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4985)
        at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:201)
[/code]

If have put both toplink jars in the lib directory of the server, of the domain, in the ear and in both projects, the java jpa project and the ejb project, with no success.

Any help would be greatly appreciated.

Thanks in advance,
Sam
[Message sent by forum member 'shwoodard' (shwoodard)]

http://forums.java.net/jive/thread.jspa?messageID=353685