0

I have following error and I really don't know what to do: (Java - gRPC, deploying to minishift)

Starting the Java application using /opt/jboss/container/java/run/run-java.sh ...

INFO exec  java -javaagent:/opt/jboss/container/jolokia/jolokia.jar=config=/opt/jboss/container/jolokia/etc/jolokia.properties -XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=100m -XX:+ExitOnOutOfMemoryError -cp "." -jar /deployments/demo-0.0.1-SNAPSHOT.jar  
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
**Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: io/grpc/BindableService
    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.grpc.BindableService
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
... 7 more**
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83

2 Answers2

0

It looks you are running your application on a different JDK other than the one used for build. Can you try to rebuild on the platform you are running on?

voidzcy
  • 520
  • 2
  • 7
0

I had the same issue and checked the contents of the jar file with jar -xf [your_jar_file].jar and saw that there were no classes related to grpc or any other dependencies I listed in pom.xml

So I found this answer which helps you package your jar with the dependencies. Please read all the comments under the answer before continuing.

After doing that I was able to run with no problems and sure enough the classes were in the jar when I unpackaged.

degemenc
  • 481
  • 4
  • 10