gpt4 book ai didi

maven - java.lang.ClassNotFoundException : org. json.JSONException

转载 作者:行者123 更新时间:2023-12-04 12:52:16 28 4
gpt4 key购买 nike

我正在构建一个简单的 Maven 项目。我使用构建路径添加 json作为第三方库并将其添加到 web-inf图书馆。最后,我在 pom.xml 中添加了依赖项.但是,通过上述所有努力,我仍然遇到此异常。任何信息和建议表示赞赏!

下面是异常(exception)

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>

最佳答案

你可以解决这个添加以下依赖项( http://mvnrepository.com/artifact/org.json/json/20080701 )

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20080701</version>
</dependency>

关于maven - java.lang.ClassNotFoundException : org. json.JSONException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27644086/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com