2012-01-03 48 views
0

GWT - > RPC - >的MongoDB(嗎啡)GWT +蒙戈(嗎啡)= IncompatibleClassChangeError

Caused by: java.lang.IncompatibleClassChangeError: Implementing class 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791) 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) 
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) 
    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 

com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:372) 
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366) 
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337) 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791) 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) 
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) 
    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 

com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:372) 
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366) 
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337) 
    at com.mongodb.MongoOptions.reset(MongoOptions.java:47) 
    at com.mongodb.MongoOptions.<init>(MongoOptions.java:29) 
    at com.mongodb.Mongo.<init>(Mongo.java:148) 
    at com.mongodb.Mongo.<init>(Mongo.java:113) 
    at 

myapp.database.MyCodeImpl.getDataSource(MyCodeImpl.java:42) 
    at 

MyCodeImpl.getDataSource():

public Datastore getDataSource() { 
    try { 
     Morphia morphia = new Morphia(); 
     Mongo db = new Mongo("localhost"); 
     return morphia.createDatastore(db, getDatabaseName()); 
    } catch (UnknownHostException e) { 
     e.printStackTrace(); 
     throw new DatabaseException(); 
    } 
} 

線42:蒙戈分貝=新蒙戈( 「本地主機」);

沒有GWT工作正常。爲什麼不適用於GWT? 看起來像com.mongodb.DbDecoder問題...有什麼建議嗎?

回答

1

從堆棧跟蹤看起來它是一個GWT問題。確保不要將gwt-user.jar或gwt-dev.jar部署到您的Jetty。還要確保你的類路徑中只有一個GWT版本。

+0

同意!確保所有.jar庫(MongoDB等)都在war \ WEB-INF \ lib中,而不是任何子目錄。 – vladaman 2012-04-07 06:53:44