PlayDependencyClassLoader does not find application code
- by jkschneider
When a third party dependency attempts to load a class defined in a Play application using
Class.forName(className, true, Thread.currentThread().getContextClassLoader());
Play will throw a ClassNotFoundException because the context class loader is of type PlayDependencyClassLoader which apparently only contains classes defined in jar dependencies.
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: eventstore.Commit
at org.mapdb.SerializerPojo.classForName(SerializerPojo.java:96)
at org.mapdb.SerializerPojo$1.deserialize(SerializerPojo.java:74)
at org.mapdb.SerializerPojo$1.deserialize(SerializerPojo.java:39)
This only occurs when Play is started with play run. Starting Play with play start loads the class correctly.
It would be a shame to sacrifice the class hot-swapping because of this behavior. Is there a known workaround?