2016-02-18 84 views
0

我在Jetty 9日誌中看到這個異常。我有下面設置的gradle依賴關係。你們都知道爲什麼我得到java.lang.NoSuchFieldError:NONE異常。Hibernate和Java持久化API - java.lang.NoSuchFieldError:NONE

搖籃依賴 -

compile 'redis.clients:jedis:2.6.2', 
     "javax.persistence:persistence-api:${javaPersistenceVersion}", 
     "org.hibernate:hibernate-core:${hibernateVersion}", 
     "org.hibernate:hibernate-entitymanager:${hibernateVersion}", 
     "mysql:mysql-connector-java:${mysqlVersion}" 

屬性 -

hibernateVersion=4.3.8.Final 
mysqlVersion=5.1.34 
slf4jVersion=1.7.5 
javaServletVersion=2.5 
javaPersistenceVersion=1.0.2 

例外 -

SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to 
the HTTP container 
java.lang.NoSuchFieldError: NONE 
    at org.hibernate.jpa.spi.AbstractQueryImpl.<init>(AbstractQueryImpl.java:116) 
    at org.hibernate.jpa.internal.QueryImpl.<init>(QueryImpl.java:94) 
    at org.hibernate.jpa.internal.QueryImpl.<init>(QueryImpl.java:87) 

.....

javax.servlet.ServletException: java.lang.NoSuchFieldError: NONE 
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558) 

.....

Caused by: 
java.lang.NoSuchFieldError: NONE 
    at org.hibernate.jpa.spi.AbstractQueryImpl.<init>(AbstractQueryImpl.java:116) 
    at org.hibernate.jpa.internal.QueryImpl.<init>(QueryImpl.java:94) 
    at org.hibernate.jpa.internal.QueryImpl.<init>(QueryImpl.java:87) 
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:328) 

回答

0

不知道這樣做的伎倆,但休眠4.3是JPA 2.1的實現,所以......

javaPersistenceVersion=1.0.2

...似乎遙遠?

JPA版本展現在Hibernate ORM 4.3 documentation

BR, 延