我在Jetty 9日志中看到了这个异常。我有下面设置的gradle依赖项。你们都知道我为什么得到java.lang.NoSuchFieldError:NONE异常。
Gradle依赖项 -
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 :(得分:0)
不确定这是否有效,但Hibernate 4.3是JPA 2.1实现,所以......
javaPersistenceVersion = 1.0.2
...似乎有点离开?
JPA版本显示在Hibernate ORM 4.3 documentation
中BR, 延