Permanent presence provider not found with JBoss AS 7

I just migrated from Tomcat to JBoss AS 7. So I configured the Mysql datasource in JBoss (adding a module.xml with the appropriate Jar, adding a driver block to standalone.xml and configuring the datasource via the JBoss interface.

There are no errors when deploying, but unable to get entityManager (JPA with Hibernate in background).

Indeed, when this code is executed:

Persistence.createEntityManagerFactory("RoomManagement");

      

I am getting this error:

javax.persistence.PersistenceException: Persistence provider for EntityManager named RoomManagement javax.persistence.Persistence.createEntityManagerFactory (Persistence.java:69) javax.persistence.Persistence.createEntityManagerFactory (Persistence.java:47)

Very strange, because I have checked well that my persistence.xml actually takes place in War in the WEB-INF / classes / META-INF directory.

My persistence.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">

    <persistence-unit name="RoomManagement" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:jboss/datasources/MySqlDS</jta-data-source>
        <class>com.parisdescartes.roommanagement.domain.entities.Address</class>
        <class>com.parisdescartes.roommanagement.domain.entities.Building</class>
        <class>com.parisdescartes.roommanagement.domain.entities.Civility</class>
        <class>com.parisdescartes.roommanagement.domain.entities.EventType</class>
        <class>com.parisdescartes.roommanagement.domain.entities.Job</class>
        <class>com.parisdescartes.roommanagement.domain.entities.Reservation</class>
        <class>com.parisdescartes.roommanagement.domain.entities.Room</class>
        <class>com.parisdescartes.roommanagement.domain.entities.RoomType</class>
        <class>com.parisdescartes.roommanagement.domain.entities.Tool</class>
        <class>com.parisdescartes.roommanagement.domain.entities.User</class>
        <class>com.parisdescartes.roommanagement.domain.entities.UserDetail</class>
        <class>com.parisdescartes.roommanagement.domain.entities.Schedule</class>
        <properties>
            <property name="hibernate.connection.autocommit" value="true" />
            <property name="hibernate.archive.autodetection" value="class"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hbm2ddl.auto" value="update"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        </properties>
    </persistence-unit>
</persistence> 

      

Did I make a mistake or did I forget to specify something?

+2


source to share


1 answer


Remove hibernate jar from WEB-INF/lib

. JBoss has it bundled, so if you have this on the classpath it is probably confusing the classloader.



+5


source







All Articles