-
Bug
-
Resolution: Unresolved
-
Major
-
5.3.0.Final, 5.4.1.Final
-
None
-
Workaround Exists
-
We are having problems with the EventJournal class in an OSGI environment.
When calling eventJournal.hasNext() we get the following error:
java.lang.RuntimeException: Could not instantiate class at org.mapdb.SerializerPojo.deserializeUnknownHeader(SerializerPojo.java:487)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.SerializerBase.deserialize3(SerializerBase.java:1216)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.SerializerBase.deserialize(SerializerBase.java:1132)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.SerializerBase.deserialize(SerializerBase.java:867)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.SerializerPojo.deserialize(SerializerPojo.java:705)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.BTreeMap$NodeSerializer.deserialize(BTreeMap.java:449)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.BTreeMap$NodeSerializer.deserialize(BTreeMap.java:288)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.Store.deserialize(Store.java:297)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.StoreDirect.get2(StoreDirect.java:486)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.StoreWAL.get2(StoreWAL.java:336)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.StoreWAL.get(StoreWAL.java:320)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.Caches$HashTable.get(Caches.java:246)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.EngineWrapper.get(EngineWrapper.java:58)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.BTreeMap.findLargerNode(BTreeMap.java:1461)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.BTreeMap$BTreeIterator.<init>(BTreeMap.java:861)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.BTreeMap$BTreeKeyIterator.<init>(BTreeMap.java:1041)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.BTreeMap$SubMap.keyIterator(BTreeMap.java:2278)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.BTreeMap$SubMap.isEmpty(BTreeMap.java:1939)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.modeshape.jcr.journal.LocalJournal.recordsNewerThan(LocalJournal.java:249)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.modeshape.jcr.JcrObservationManager$JcrEventJournal.advance(JcrObservationManager.java:1247)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.modeshape.jcr.JcrObservationManager$JcrEventJournal.hasNext(JcrObservationManager.java:1226)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at de.company.cmis.web.impl.version.VersioningCleanupTask.run(VersioningCleanupTask.java:100)[35:de.company.components.cmis.web:1.4.17.SNAPSHOT] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_92] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_92] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_92] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_92] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_92] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_92] at java.lang.Thread.run(Thread.java:745)[:1.8.0_92] Caused by: java.lang.RuntimeException: Could not instantiate class at org.mapdb.SerializerPojo.deserializeUnknownHeader(SerializerPojo.java:487)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.SerializerBase.deserialize3(SerializerBase.java:1216)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.SerializerBase.deserialize(SerializerBase.java:1132)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.SerializerPojo.deserializeUnknownHeader(SerializerPojo.java:481)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] ... 28 more Caused by: java.lang.RuntimeException: Could not instantiate class at org.mapdb.SerializerPojo.deserializeUnknownHeader(SerializerPojo.java:487)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.SerializerBase.deserialize3(SerializerBase.java:1216)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.SerializerBase.deserialize(SerializerBase.java:1132)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] at org.mapdb.SerializerPojo.deserializeUnknownHeader(SerializerPojo.java:481)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9] ... 31 more Caused by: java.lang.ClassNotFoundException: org.modeshape.jcr.cache.change.PropertyAdded at java.net.URLClassLoader.findClass(URLClassLoader.java:381)[:1.8.0_92] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)[:1.8.0_92] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)[:1.8.0_92] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_92] at java.lang.Class.forName0(Native Method)[:1.8.0_92] at java.lang.Class.forName(Class.java:348)[:1.8.0_92] at org.mapdb.SerializerPojo$ObjectInputStream2.resolveClass(SerializerPojo.java:627) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620)[:1.8.0_92] at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)[:1.8.0_92] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781)[:1.8.0_92] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)[:1.8.0_92] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)[:1.8.0_92] at java.util.concurrent.ConcurrentLinkedQueue.readObject(ConcurrentLinkedQueue.java:784)[:1.8.0_92] at sun.reflect.GeneratedMethodAccessor261.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_92] at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_92] at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)[:1.8.0_92] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)[:1.8.0_92] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)[:1.8.0_92] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)[:1.8.0_92] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)[:1.8.0_92] at org.mapdb.SerializerPojo.deserializeUnknownHeader(SerializerPojo.java:465)[42:de.company.components.contentrepository.modeshape-bundle:2.2.9]
The problem seems to be:
1. mapdb wants to serialize or deserialize s.th. (the modeshape class "PropertyAdded")
2. mapdb tries to load the class and uses "Class.forName" to do so
3. This means mapdb uses the framework classloader to load the class
4. The framework classloader only knows the framework classes and the base libs
In an OSGI environment we should never use Class.forName to load classes.