after assembling jar - No Persistence provider for EntityManager named ....

Posted by alabalaa on Stack Overflow See other posts from Stack Overflow or by alabalaa
Published on 2010-03-16T17:25:09Z Indexed on 2010/03/16 17:41 UTC
Read the original article Hit count: 196

Filed under:
|
|

im developing a standalone application and it works fine when starting it from my ide(intellij idea), but after creating an uberjar and start the application from it javax.persistence.spi.PersistenceProvider is thrown saying "No Persistence provider for EntityManager named testPU"

here is my persistence.xml which is placed under meta-inf directory:

 <persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL">
     <provider>org.hibernate.ejb.HibernatePersistence</provider>
     <class>test.model.Configuration</class>
     <properties>
         <property name="hibernate.connection.username" value="root"/>
         <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
         <property name="hibernate.connection.password" value="root"/>
         <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test"/>
         <property name="hibernate.show_sql" value="true"/>
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
         <property name="hibernate.c3p0.timeout" value="300"/>
         <property name="hibernate.hbm2ddl.auto" value="update"/>
     </properties>
 </persistence-unit>

and here is how im creating the entity manager factory:

emf = Persistence.createEntityManagerFactory("testPU");

im using maven and tried the assembly plug-in with the default configuration fot it, i dont have much experience with assembling jars and i dont know if im missing something, so if u have any ideas ill be glad to hear them

© Stack Overflow or respective owner

Related posts about java

Related posts about jpa