mapdb icon indicating copy to clipboard operation
mapdb copied to clipboard

java.lang.NoClassDefFoundError: org/mapdb/elsa/ElsaSerializerBase$Ser

Open prsalazar opened this issue 9 years ago • 6 comments

Hi, I'm using BTreemap to store <Integer, List> where myclass is an enum impliments Serializable. I've been using mapdb version 1 without any issues and very fast. I'm trying to upgrade to version 3 and it is not going well at all. My dependencies are:

	<dependency>
		<groupId>org.mapdb</groupId>
		<artifactId>mapdb</artifactId>
		<version>3.0.5</version>
		<type>jar</type>
                    <scope>compile</scope>
	</dependency>
	
	<dependency>
	    <groupId>org.mapdb</groupId>
		     <artifactId>elsa</artifactId>
		     <version>3.0.0-M7</version>
	     <type>jar</type>
                 <scope>compile</scope>
	</dependency>

And here is my code:

private BTreeMap<Integer,List<State>> stateStateList;

	db =	DBMaker.fileDB(tfile).closeOnJvmShutdown().fileMmapEnable().allocateStartSize( 256 *1024*1024).allocateIncrement(128 * 1024*1024).make();
	stateStateList =  db.treeMap("stateMap").keySerializer(Serializer.INTEGER).valueSerializer(Serializer.ELSA).createOrOpen();

I've tried many different experiments and no luck. Hope you can help. I did notice that the elsa jar contains: org/mapdb/elsa/ElsaSerializerBase$Serializer.class and not org/mapdb/elsa/ElsaSerializerBase$Ser

Rest of the error trace: Exception in thread "Converter Thread" java.lang.NoClassDefFoundError: org/mapdb/elsa/ElsaSerializerBase$Ser at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.mapdb.DB.(DB.kt:176) at org.mapdb.DB.(DB.kt:40) at org.mapdb.DBMaker$Maker.make(DBMaker.kt:477)

thanks Paul

prsalazar avatar Aug 30 '17 20:08 prsalazar

MapDB has some extra dependencies. Checkout pom.xml for list of dependencies.

jankotek avatar Oct 11 '17 14:10 jankotek

I have added all Dependencies but still Exception in thread "main" java.lang.NoClassDefFoundError: org/mapdb/elsa/ElsaSerializerPojo at org.mapdb.serializer.SerializerElsa.<init>(SerializerElsa.kt:12) at org.mapdb.Serializer.<clinit>(Serializer.java:363) at org.mapdb.DB.<clinit>(DB.kt:45) at org.mapdb.DBMaker$Maker.make(DBMaker.kt:477)

umairsajid0017 avatar Sep 05 '18 13:09 umairsajid0017

Make sure you get the required version of the Elsa library as required by each MapDB version[1]. I had another version of the Elsa library and got the same error as you; fixed when I used the correct version.

[1] - https://mvnrepository.com/artifact/org.mapdb/mapdb/3.0.7

catalin-arsenescu avatar Oct 17 '18 12:10 catalin-arsenescu

MapDB has some extra dependencies. Checkout pom.xml for list of dependencies.

hello,i use version 3.0.7,and has the same proble ,and ,could you please copy out your dependencies on pom.xml

sunyaf avatar Jun 21 '19 03:06 sunyaf

You need to use ELSE version 3.0.0-M5 instead of 3.0.0-M7 on your pom.xml file

azhalm94 avatar Dec 15 '19 09:12 azhalm94

I ran into just this problem just now.... @ALMustafaAzhari is correct.

stefan-reich avatar Aug 04 '20 21:08 stefan-reich