java - javax.persistence.Persistence.getPersistenceUtil()Ljavax/persistence/PersistenceUtil -
in spring-mvc application try use validators. put annotation @notempty , @email on 1 of entity , when try validate error:
java.lang.nosuchmethoderror: javax.persistence.persistence.getpersistenceutil()ljavax/persistence/persistenceutil; @ org.hibernate.validator.engine.resolver.jpatraversableresolver.isreachable(jpatraversableresolver.java:33) @ org.hibernate.validator.engine.resolver.defaulttraversableresolver.isreachable(defaulttraversableresolver.java:112) @ org.hibernate.validator.engine.resolver.singlethreadcachedtraversableresolver.isreachable(singlethreadcachedtraversableresolver.java:47) @ org.hibernate.validator.engine.validatorimpl.isvalidationrequired(validatorimpl.java:764) @ org.hibernate.validator.engine.validatorimpl.validateconstraint(validatorimpl.java:331) @ org.hibernate.validator.engine.validatorimpl.validateconstraintsforredefineddefaultgroup(validatorimpl.java:278) @ org.hibernate.validator.engine.validatorimpl.validateconstraintsforcurrentgroup(validatorimpl.java:260) @ org.hibernate.validator.engine.validatorimpl.validateincontext(validatorimpl.java:213) @ org.hibernate.validator.engine.validatorimpl.validate(validatorimpl.java:119) @ org.springframework.validation.beanvalidation.springvalidatoradapter.validate(springvalidatoradapter.java:102) @ org.springframework.validation.databinder.validate(databinder.java:772)
i think there problem dependencies can figure out. here dependencies in pom:
<dependencies> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-beans</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-aop</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-expression</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-jdbc</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-tx</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework.security</groupid> <artifactid>spring-security-core</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework.security</groupid> <artifactid>spring-security-web</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework.security</groupid> <artifactid>spring-security-config</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework.security</groupid> <artifactid>spring-security-taglibs</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-aop</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-webmvc</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-orm</artifactid> <version>3.2.5.release</version> </dependency> <dependency> <groupid>antlr</groupid> <artifactid>antlr</artifactid> <version>2.7.6</version> </dependency> <dependency> <groupid>asm</groupid> <artifactid>asm</artifactid> <version>1.5.3</version> </dependency> <dependency> <groupid>asm</groupid> <artifactid>asm-attrs</artifactid> <version>1.5.3</version> </dependency> <dependency> <groupid>aopalliance</groupid> <artifactid>aopalliance</artifactid> <version>1.0</version> </dependency> <dependency> <groupid>cglib</groupid> <artifactid>cglib</artifactid> <version>2.1_3</version> </dependency> <dependency> <groupid>commons-beanutils</groupid> <artifactid>commons-beanutils</artifactid> <version>1.7.0</version> </dependency> <dependency> <groupid>commons-logging</groupid> <artifactid>commons-logging</artifactid> <version>1.1.1</version> </dependency> <dependency> <groupid>commons-digester</groupid> <artifactid>commons-digester</artifactid> <version>1.8</version> </dependency> <!-- apache commons upload --> <dependency> <groupid>commons-fileupload</groupid> <artifactid>commons-fileupload</artifactid> <version>1.2.2</version> </dependency> <!-- apache commons upload --> <dependency> <groupid>commons-io</groupid> <artifactid>commons-io</artifactid> <version>1.3.2</version> </dependency> <dependency> <groupid>org.apache.poi</groupid> <artifactid>poi</artifactid> <version>3.9</version> </dependency> <dependency> <groupid>org.apache.poi</groupid> <artifactid>poi-ooxml</artifactid> <version>3.9</version> </dependency> <dependency> <groupid>commons-validator</groupid> <artifactid>commons-validator</artifactid> <version>1.4.0</version> </dependency> <dependency> <groupid>commons-lang</groupid> <artifactid>commons-lang</artifactid> <version>2.5</version> </dependency> <dependency> <groupid>dom4j</groupid> <artifactid>dom4j</artifactid> <version>1.6.1</version> </dependency> <dependency> <groupid>net.sf.dozer</groupid> <artifactid>dozer</artifactid> <version>5.3.2</version> </dependency> <dependency> <groupid>org.apache.xmlbeans</groupid> <artifactid>xmlbeans</artifactid> <version>2.4.0</version> <scope>runtime</scope> </dependency> <dependency> <groupid>net.sf.ehcache</groupid> <artifactid>ehcache</artifactid> <version>1.2.3</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate</artifactid> <version>3.2.6.ga</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-annotations</artifactid> <version>3.3.1.ga</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-commons-annotations</artifactid> <version>3.0.0.ga</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-entitymanager</artifactid> <version>3.2.0.ga</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-validator</artifactid> <version>3.0.0.ga</version> </dependency> <dependency> <groupid>com.ibm.icu</groupid> <artifactid>icu4j</artifactid> <version>2.6.1</version> </dependency> <dependency> <groupid>javassist</groupid> <artifactid>javassist</artifactid> <version>3.4.ga</version> </dependency> <dependency> <groupid>javax.xml</groupid> <artifactid>jaxb-api</artifactid> <version>2.1</version> </dependency> <dependency> <groupid>javax.xml</groupid> <artifactid>jaxb-impl</artifactid> <version>2.1</version> </dependency> <dependency> <groupid>javax.mail</groupid> <artifactid>mail</artifactid> <version>1.4</version> </dependency> <dependency> <groupid>jaxen</groupid> <artifactid>jaxen</artifactid> <version>1.1.1</version> </dependency> <dependency> <groupid>org.jdom</groupid> <artifactid>jdom</artifactid> <version>1.1</version> </dependency> <dependency> <groupid>jstl</groupid> <artifactid>jstl</artifactid> <version>1.2</version> </dependency> <dependency> <groupid>javax.transaction</groupid> <artifactid>jta</artifactid> <version>1.1</version> </dependency> <dependency> <groupid>log4j</groupid> <artifactid>log4j</artifactid> <version>1.2.16</version> </dependency> <dependency> <groupid>org.apache.lucene</groupid> <artifactid>lucene-core</artifactid> <version>2.3.2</version> </dependency> <dependency> <groupid>org.apache.lucene</groupid> <artifactid>lucene-highlighter</artifactid> <version>2.0.0</version> </dependency> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.0.5</version> </dependency> <dependency> <groupid>javax.persistence</groupid> <artifactid>persistence-api</artifactid> <version>1.0</version> </dependency> <dependency> <groupid>quartz</groupid> <artifactid>quartz</artifactid> <version>1.5.2</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.5.6</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.5.6</version> </dependency> <dependency> <groupid>stax</groupid> <artifactid>stax-api</artifactid> <version>1.0.1</version> </dependency> <dependency> <groupid>javax.validation</groupid> <artifactid>validation-api</artifactid> <version>1.0.0.ga</version> </dependency> <dependency> <groupid>xalan</groupid> <artifactid>xalan</artifactid> <version>2.6.0</version> </dependency> <dependency> <groupid>xerces</groupid> <artifactid>xercesimpl</artifactid> <version>2.6.2</version> </dependency> <dependency> <groupid>xml-apis</groupid> <artifactid>xml-apis</artifactid> <version>1.3.02</version> </dependency> <dependency> <groupid>xml-apis</groupid> <artifactid>xmlparserapis</artifactid> <version>2.0.2</version> </dependency> <dependency> <groupid>xom</groupid> <artifactid>xom</artifactid> <version>1.0</version> </dependency> </dependencies>
edit
i try change hibernate dependencies one:
<dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-annotations</artifactid> <version>3.4.0.ga</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-entitymanager</artifactid> <version>3.6.10.final</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-validator</artifactid> <version>3.0.0.ga</version> </dependency>
so in dependency hierarchy can see use jpa2, still have same issue...
javax.persistence.persistence.getpersistenceutil()
is method added in jpa 2.0 , hibernate validator using it. have declared jpa 1.0 in pom.xml have mismatch in versions.
Comments
Post a Comment