-->
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.  [ 5 posts ] 
Author Message
 Post subject: JPA jars
PostPosted: Fri Nov 02, 2007 3:13 am 
Newbie

Joined: Fri Nov 02, 2007 3:05 am
Posts: 3
Hi,

I am trying to get started with JPA in a standalone application. Jars are in the classpath, persistence.xml is there, but it gives me an exception on the first line:

emf = Persistence.createEntityManagerFactory("punit");

Code:
java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.M
ap, org.hibernate.annotations.common.reflection.ReflectionManager)



It looks like a jar versions problem, but I have the latest jars:

Code:
antlr-2.7.6.jar                    443 432  2006/05/05
asm-attrs.jar                       16 777  2005/03/17
asm.jar                             26 360  2005/03/17
cglib-2.1.3.jar                    282 338  2005/12/02
dom4j-1.6.1.jar                    313 898  2005/08/13
ehcache-1.2.3.jar                  208 048  2006/11/03
ejb3-persistence.jar                50 574  2007/03/28
hibernate-annotations.jar          265 130  2007/03/28
hibernate-commons-annotations.jar   66 426  2007/03/28
hibernate-entitymanager.jar        116 544  2007/03/28
hibernate-validator.jar             60 992  2007/03/28
hibernate3.jar                   2 255 753  2007/07/31
javassist.jar                      471 005  2006/11/16
jboss-archive-browsing.jar         413 698  2007/03/28
jdbc2_0-stdext.jar                   6 727  2004/06/03
jta.jar                              8 812  2004/06/03



(Apache commons and mysql libs are also there in another dir.)

persistence.xml is read in, if I deliberately make an xml syntax error, the parser complains.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<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="punit">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <properties>
         <property name="hibernate.show_sql" value="true" />
         <property name="hibernate.format_sql" value="true" />
         <property name="hibernate.connection.driver_class"
            value="com.mysql.jdbc.Driver" />
         <property name="hibernate.connection.url"
            value="jdbc:mysql://localhost:3306/nyilzar2?characterEncoding=utf8" />
         <property name="hibernate.connection.username" value="..." />
         <property name="hibernate.connection.password" value="..." />
         <property name="hibernate.dialect"
            value="org.hibernate.dialect.MySQLDialect" />
      </properties>
   </persistence-unit>
</persistence>




Please help.

kuvera


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 02, 2007 7:39 am 
Regular
Regular

Joined: Tue Jan 03, 2006 9:20 am
Posts: 74
Looks like a versioning problem.
Maybe your validator-jar is older than the one relying on it and contains an older version of ClassValidator.

The constructor is there in the 3.0.0GA release, so if you have an older one you may want to upgrade your validator-jar.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 02, 2007 8:01 am 
Newbie

Joined: Fri Nov 02, 2007 3:05 am
Posts: 3
I checked again. It is the latest, 3.0.0 version. Don't know what to do. :(


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 02, 2007 9:34 am 
Newbie

Joined: Fri Nov 02, 2007 3:05 am
Posts: 3
The problem is gone. I usually have a few JAR repositories in the classpath (jakarta commons, etc.). I removed everything but Hibernate-needed jars, and now it works. I still don't know which jar caused the problem.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 02, 2007 4:02 pm 
Regular
Regular

Joined: Tue Jan 03, 2006 9:20 am
Posts: 74
Add them back one by one until the problem reappears.

It could theoretically also be an ordering problem. Change the order of jars on the classpath and sometimes problems appear or disappear as the order of the jars controls the order of classloading.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.