我正在和riak一起工作。试图从Java访问它。这是代码:
package eee.xxx;
import com.basho.riak.client.IRiakClient;
import com.basho.riak.client.RiakException;
import com.basho.riak.client.RiakFactory;
import com.basho.riak.client.bucket.Bucket;
public class Main {
/**
* @param args
* @throws RiakException
*/
public static void main(String[] args) throws RiakException {
IRiakClient myClient = RiakFactory.httpClient("127.0.0.1");
Bucket myBucket = myClient.fetchBucket("Pacan").execute();
}
}
在编译之后,它会抛出这样的错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONException
at com.basho.riak.client.raw.http.HTTPClientAdapter.<init>(HTTPClientAdapter.java:85)
at com.basho.riak.client.RiakFactory.httpClient(RiakFactory.java:144)
at eee.xxx.Main.main(Main.java:18)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
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:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 3 more
我不知道如何解决这个问题。请帮忙! : - )