ClassNotFoundException for case class in Play application



I’m working with scala Play application. Aerospike is used as a storage for high load system. I’ve written the code that save and load plenty of data in LDT (LargeList). When running tests everything works just fine. When to call the same methods from the application (from Play Action, which process user request or from Play’s Global object), then I recive Error Code -1: java.lang.ClassNotFoundException: models.Aero.FileEntry, where the last is my model’s case class. What is the reason of such strange behaviour? How can I fix it? Exception arises when calling llist.scan or llist.find. The same code in tests - everything ok.



I faced same kind of problem with java play

Tried with empty constructor but couldnt work.It seems related to class loading behaviour in play.


Exectly what I think! Something wrong with the class loading with Play. As I wrote during tests everything work as it should. It would be very useful to know the reason of this strange behaviour and to know how to make it work. At a moment I have to change the model to avoid Java (scala) objects serialization. This is inconvenient though…


If you put your model classes in seperate project and add it’s published jar as dependency in current project then it will work.



FYI, I’ve written a simple To-Do web app using Play, Java, Scala and Aerospike. Here’s the link to detailed blog post on it It also has link to the GitHub repo which contains the entire solution.

If you have any questions or feedback, please feel free to reach out to me on skype: iamontheinet