4

我将 Parse4j 导入到我的项目中。

我的项目有以下教程行:

Parse.initialize("xyz", "abc");
ParseObject team = new ParseObject("GameScore");
team.put("score", 1337);
team.put("playerName", "Neymar");
team.save();

对于最后一行,抛出以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/config/RequestConfig
    at org.parse4j.command.ParseCommand.<clinit>(ParseCommand.java:29)
    at org.parse4j.ParseObject.save(ParseObject.java:443)
    at Main.main(Main.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.config.RequestConfig
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 8 more

不确定这是如何解决的。任何帮助表示赞赏。

4

1 回答 1

5

将以下内容添加到您的 pom.xml:

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.3.3</version>
</dependency>
于 2014-06-12T21:41:54.327 回答