I work with protobufs with a game platform 2.1.3 without problems. Then I needed to convert protobuffs to JSON, so I turned on
"com.googlecode.protobuf-java-format" % "protobuf-java-format" % "1.2"
at Build.scala.
Trying to hide any protobuf for JSON using
JsonFormat.printToString(message);
This leads to the following error when starting in dev mode (starting from the playback run)
play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.NoClassDefFoundError: com/google/protobuf/InvalidProtocolBufferException]] ... Caused by: java.lang.NoClassDefFoundError: com/google/protobuf/InvalidProtocolBufferException ... Caused by: java.lang.ClassNotFoundException: com.google.protobuf.InvalidProtocolBufferException at java.net.URLClassLoader$1.run(URLClassLoader.java:202) ~[na:1.6.0_51] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_51] at java.net.URLClassLoader.findClass(URLClassLoader.java:190) ~[na:1.6.0_51] at java.lang.ClassLoader.loadClass(ClassLoader.java:306) ~[na:1.6.0_51] at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ~[na:1.6.0_51] at sbt.PlayCommands$$anonfun$53$$anonfun$55$$anon$2.loadClass(PlayCommands.scala:535) ~[na:na]
If playback starts in run mode, I have no errors.
I managed to get it to work in dev mode if I put the source code of the protobuf-java file in my application folder. This works as a workaround, but I would like to know the correct way to solve this problem.
Additional Information: As suggested below, I checked the game class, earned the dependencies, and searched my system, and I only have one copy of the included jar.
I can work without problems:
Exception e = new InvalidProtocolBufferException()
NoClassDefFoundError is thrown when I try to use some static method from protobuf-java library. For instance:
XmlFormat.printToString(message)
It does not work in dev mode, but it works in production mode (game start). Interestingly, a class that says it cannot find is different:
[RuntimeException: java.lang.NoClassDefFoundError: com/google/protobuf/Message]
I use the methods from the protobuf library without any problems elsewhere, so I know that they are included in the class path.
From google, I was able to find another instance that has similar problems: https://groups.google.com/forum/#!msg/play-framework/i0RNcu8PZOY/J7cy18xsg3oJ
I was not able to figure out how to refactor the code to make it work.