java.lang.NoClassDefFoundError: org/mapdb/DBMaker

1.5k Views Asked by At

I have problem using mapDB on GWT, i found error in this line:

File utilizzo = new File("saveme.db");

DB db;

db = DBMaker.newFileDB(utilizzo).closeOnJvmShutdown().make();

the error is in the third line and is:

nov 20, 2014 11:20:30 AM com.google.appengine.tools.development.ApiProxyLocalImpl log GRAVE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String com.sample.Doodle.client.GreetingService.greetServer(java.util.ArrayList) throws java.lang.IllegalArgumentException' threw an unexpected exception: java.lang.NoClassDefFoundError: org/mapdb/DBMaker

2

There are 2 best solutions below

0
On BEST ANSWER

This error means that a class is not available on the server. It's not enough to add a jar to your classpath - you also need to add it to your /WEB-INF/lib folder.

If you use Eclipse, select your project and look in the Problems tab. There may be a warning there that a particular resource will not be available on the server. Right-click on this warning and select "Copy to..." option. Or add this jar to this folder manually.

0
On

I had the same error when I changed an object that was already persisted. When DBMaker tried to make the existing database it tries to map the persisted objects to existing classes in the classpath. If the class has changed signature - i.e., name or package - it cannot be mapped to the persisted object, hence the ClassNotFoundException.