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