Play-slick Plugin Error Message: NoClassDefFoundError: org/reflections/scanners/TypesScanner

Last updated:

I've had this error bug me (pun unintended) for almost a whole day.

error sreenshot

Turns out it was because my options for Slick in application.conf looked like this:

# Evolutions
# ~~~~~
# You can disable evolutions if needed
# evolutionplugin=disabled
slick.default= "models.domain.*"

That makes Slick try to read everything it finds under models.domain as a Class that should be turned into a database table.

If you have other classes (case classes, object and so on) under those packages, Slick will try to parse its declaration (using Reflection) and make a database table out of it, and of course it will fail because not all of those are meant to be such.

The error message isn't one of the clearest ever but the problem should go away if you instead name each class separately:

slick.default= "models.domain.Queries,models.domain.Users"

Or else make sure that only Classes that should map to database tables live under that package.

Dialogue & Discussion