1 Reply Latest reply on Mar 30, 2009 5:23 PM by norman

    Persistence Unit question

    germandev.net-seam.wje-online.de

      Hi!


      I was working on a seam project that works great on my local server (JBoss AS 4.2.3GA). I now tried to publish it to another server by copying the 'my-project-ds.xml' and 'my-project.ear' to the remote deploy folder and it was recognized.


      But instead of working correctly the following error message is shown when loading the .ear:


      java.lang.RuntimeException: Illegal @PersistenceUnit on javax.persistence.EntityManager org.my-project.session.AssignManager.em :There is no default persistence unit in this deployment.
              at org.jboss.injection.PersistenceContextHandler.handleFieldAnnotations(PersistenceContextHandler.java:182)
              at org.jboss.injection.InjectionUtil.processFieldAnnotations(InjectionUtil.java:137)
              at org.jboss.injection.InjectionUtil.processAnnotations(InjectionUtil.java:174)
              at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:361)
              at org.jboss.ejb3.SessionContainer.processMetadata(SessionContainer.java:140)
              at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:292)
      ... 



      The AssignManager entity is used to create new (not login) uesrs. This is its code:


      @Name("assignManager")
      @Stateful
      @Scope(ScopeType.SESSION)
      public class AssignManager implements Serializable, IAssignManager
      {
      
           private static final long serialVersionUID = 1L;
           private LoginUser user = new LoginUser();
           @PersistenceContext(type=PersistenceContextType.EXTENDED)
           EntityManager em;
           
           @In FacesMessages facesMessages;
           public LoginUser getUser() {
                return user;
           }
      
           public void setUser(LoginUser user) {
                this.user = user;
           }
           
           
           public String assign()
           {
                user = em.merge(user);
                facesMessages.add("User '" + user + "' created successfully");
                return null;
           }
           
           @Remove @Destroy
           public void remove()
           {}
      }
      



      Do you know what the source of that error might be?


      Why does it work on the same JBoss AS and Seam version (the latest) locally but doesn't run on my remote server?


      Thank you in advance!