0
votes

I'm running a JBoss 5 server on my local computer and I need to have a working database connection from my Java EE project to a postgresql database. I've developed a java class called UserManager whose code is :

import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;


@Stateless(name="UserManager1")
@Local(UserManagerItf.class)
public class UserManager implements UserManagerItf {

    @PersistenceContext
    private EntityManager em;

    public boolean addUser(Joueur j) {
        Joueur jexist = em.find(Joueur.class, j.getLogin());
        if(jexist==null) {
            em.persist(j);
            return true;
        } else {
            return false;
        }

    }

}

Problem is, after I export my .war file using eclipse and I run jboss with my .war file in deploy, I get this deployment error:


18:47:27,645 INFO  [BeanInstantiatorDeployerBase] Installed org.jboss.ejb3.instantiator.impl.Ejb31SpecBeanInstantiator@57b08b4f into MC at org.jboss.ejb.bean.instantiator/JEE/JEE/UserManager1
18:47:27,650 WARN  [InterceptorInfoRepository] EJBTHREE-1852: InterceptorInfoRepository is deprecated
18:47:28,062 INFO  [BeanInstantiatorDeployerBase] Uninstalled org.jboss.ejb3.instantiator.impl.Ejb31SpecBeanInstantiator@57b08b4f from MC at org.jboss.ejb.bean.instantiator/JEE/JEE/UserManager1
18:47:28,063 ERROR [AbstractKernelController] Error installing to Real: name=vfs:///home/tuxer/jboss/jboss6/server/default/deploy/JEE.war state=PreReal mode=Manual requiredState=Real: org.jboss.deployers.spi.DeploymentException: Error deploying JEE.war: Error creating ejb container UserManager1: Container jboss.j2ee:jar=JEE.war,name=UserManager1,service=EJB3,VMID=11d1def534ea1be0:-3567a2b:137b33e6929:-7ffd + is already registered

Thank you for any answer you might provide.

1

1 Answers

1
votes

Self answer, in case anyone is interested. I included jboss in my eclipse librairies the wrong way, by adding the jars one by one instead of adding the Server Runtime option in Librairies.

I recreated the project and added my libs correctly, now it works.