【发布时间】:2015-02-22 23:54:06
【问题描述】:
我正在构建一个简单的 Maven 项目。我使用构建路径将json 添加为第三方库,并将其添加到web-inf 库中。最后,我在pom.xml 中添加了依赖项。但是,通过上述所有努力,我仍然得到这个例外。感谢您提供任何信息和建议!
以下是例外
SEVERE: Servlet.service() for servlet [sfmserver] in context with path [/mysfmovies] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.json.JSONException
下面是我的 pom.xml 的内容
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mysfmovies</groupId>
<artifactId>mysfmovies</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>mysfmovies Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.geocoder-java</groupId>
<artifactId>geocoder-java</artifactId>
<version>0.16</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>mysfmovies</finalName>
</build>
</project>
【问题讨论】:
-
您能否将
pom.xml的内容附加到问题中。 -
org.json json 20090211 提供 -
@nash_ag,对不起,我是 stackoverflow 的新手,仍在弄清楚它是如何工作的。让我知道你是否可以看到我的 pom.xml
-
我可以看到sn-p,你在
dependencies和rebuilt via mvn下添加了吗 -
我将整个 pom.xml 添加到我的问题中。是的,我想是的,我使用 Maven 构建并进行清理和安装。你是这个意思吗 ? @nash_ag
标签: maven java.lang.class jsonexception