-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Standalone application in jar
PostPosted: Wed Mar 26, 2008 9:02 pm 
Newbie

Joined: Wed Mar 26, 2008 8:55 pm
Posts: 2
Hi, I have a standaline app that uses Hibernate Annotations and EntityManager, packaged in a jar. Application runs fine when ran from eclipse but throws this when ran from jar:
Code:
Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named pauzomat-engine

I have the persistence.xml in my META-INF folder in the jar, and all libs included in the Class-Path in manifest.mf. What else do I have to do to get it working?

This is the pauzomat-engine.jar\META-INF\persistence.xml:
Code:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
   <persistence-unit name="pauzomat-engine">
   <provider>org.hibernate.ejb.HibernatePersistence</provider>
   <properties>
      <property name="hibernate.archive.autodetection" value="class, hbm"/>
      <property name="hibernate.show_sql" value="false"/>
      <property name="hibernate.format_sql" value="true"/>
      <property name="hibernate.connection.driver_class" value="org.gjt.mm.mysql.Driver"/>
      <property name="hibernate.connection.url" value="jdbc:mysql://localhost/pause"/>
      <property name="hibernate.connection.username" value="root"/>
      <property name="hibernate.connection.password" value="password"/>
      <property name="hibernate.c3p0.min_size" value="5"/>
      <property name="hibernate.c3p0.max_size" value="20"/>
      <property name="hibernate.c3p0.timeout" value="300"/>
      <property name="hibernate.c3p0.max_statements" value="50"/>
      <property name="hibernate.c3p0.idle_test_period" value="3000"/>
      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
   </properties>
   </persistence-unit>
</persistence>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 29, 2008 11:03 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

could it be that you are still missing some libraries? Check also this post: http://forum.hibernate.org/viewtopic.php?t=968997.

How does your manifest look like? As far as I know the entries for Class-Path must be space separated and relative to the location of the jar.

Have you tried to start the app by specifying all libraries/jars on the command line?

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 29, 2008 5:06 pm 
Newbie

Joined: Wed Mar 26, 2008 8:55 pm
Posts: 2
I solved it. It did turn out to be a library problem. I think some jars from entity manager were different versions than jars in hibernate core... I kept copying different versions until it worked :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.