PlayDependencyClassLoader does not find application code

Posted by jkschneider on Stack Overflow See other posts from Stack Overflow or by jkschneider
Published on 2014-05-26T23:11:32Z Indexed on 2014/05/27 3:28 UTC
Read the original article Hit count: 386

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?

© Stack Overflow or respective owner

Related posts about scala

Related posts about playframework