且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

部署到tomcat的战争无法引发java.lang.NoClassDefFoundError:javax/persistence/PersistenceException

更新时间:2022-02-02 01:55:25

您似乎缺少javax.persistence.PersistenceException类(JPA规范的一部分).

You seem to be missing the javax.persistence.PersistenceException class (part of the JPA spec).

可以在这里找到Java Persistence API JAR(包含PersistenceException类):

The Java Persistence API JAR (containing the PersistenceException class) can be found here :

http://repo1. maven.org/maven2/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar

此JAR必须位于您的WEB-INF/lib文件夹中.

This JAR needs to be in your WEB-INF/lib folder.

根据您设置Eclipse的方式,它可能会自动地(通过定义一个库)将这些JAR推送到Tomcat.

Depending on how you've setup your Eclipse, it probably pushed these JARs to Tomcat automatically (by defining a library).

但是,它试图加载PersistenceException的事实很可能意味着一旦解决此ClassNotFoundException,就会发生另一个异常(真正的异常).

However, the fact that it tries to load the PersistenceException most likely means that another exception (the real exception) will occur once you solve this ClassNotFoundException.