Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

ClassNotFound Exception when deserializing using parallel collection #65

Open
aloiscochard opened this issue Jul 30, 2012 · 1 comment

Comments

@aloiscochard
Copy link

List(json1, json2, ...).par.map(json => Json.parseFoo)

Can't find the Foo class (which is in a dependency) and throw ClassNotFound,

Work without .par

@aloiscochard
Copy link
Author

Got it working by overriding parse functions as:

override def parse[A : Manifest](input: String): A = {
val previous = Thread.currentThread.getContextClassLoader
try {
Thread.currentThread.setContextClassLoader(manifest[A].erasure.getClassLoader)
super.parseA
} finally {
Thread.currentThread.setContextClassLoader(previous)
}
}

Inpsired by: #38

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant