class not found exception when running protostuff-compiler

158 views
Skip to first unread message

sbisht

unread,
Sep 30, 2015, 3:46:43 PM9/30/15
to protostuff
Hi protostuff team / users 

I am trying to run protostuff-compiler but always getting classNotFoundException.  io/protostuff/parser/DefaultProtoLoader is present protostuff-parser jar. 

sbisht@MacBook-Pro:~/repos/protostuff/protostuff-compiler/target$ java -cp ../../protostuff-parser/target/protostuff-parser-1.3.7-SNAPSHOT.jar -jar protostuff-compiler-1.3.7-SNAPSHOT.jar 
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: io/protostuff/parser/DefaultProtoLoader
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: io.protostuff.parser.DefaultProtoLoader
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Thanks
sbisht

Kostiantyn Shchepanovskyi

unread,
Sep 30, 2015, 4:10:23 PM9/30/15
to protostuff
Hi,

I afraid you cannot run protostuff compiler this way: it has many other dependencies (in addition to parser module).
Can you use maven for code generation? We have an instruction here: http://www.protostuff.io/documentation/maven-plugin/

sbisht

unread,
Sep 30, 2015, 8:10:17 PM9/30/15
to protostuff
Thanks for the response. 

I have a gradle project and would like to call protostuff compiler during the build time. Is there a gradle equivalent of maven plugin?  

Kostiantyn Shchepanovskyi

unread,
Oct 6, 2015, 2:42:14 PM10/6/15
to protostuff
Hi @sbisht,

Just released new version - 1.3.7 that includes compiler jar with all dependencies:
You can run it using "java -jar" command.

About gradle - you can try this project: https://github.com/ramonwirsch/protostuff-gradle-plugin
Reply all
Reply to author
Forward
0 new messages