I have a demo program that shows building microservices with Hazelcast + gRPC that works fine using gRPC 1.48.0.
My build system advised that due to CVEs I should upgrade, so I moved to 1.57.2. Modules upgraded are grpc-netty-shaded (this is the one where the CVE was reported) as well as grpc-stub, grpc-protobuf, and protobuf-java (which was upgraded from 3.21.1 to 3.21.7).
After the upgrade, the server startup fails with the following stack trace:
Exception in thread "main" java.lang.NoClassDefFoundError: io/grpc/InternalGlobalInterceptors
at io.grpc.internal.ServerImplBuilder.getTracerFactories(ServerImplBuilder.java:252)
at io.grpc.internal.ServerImplBuilder.build(ServerImplBuilder.java:243)
at io.grpc.internal.AbstractServerImplBuilder.build(AbstractServerImplBuilder.java:217)
at org.example.grpc.GrpcServer.<init>(GrpcServer.java:42)
at org.hazelcast.msfdemo.invsvc.service.InventoryService.main(InventoryService.java:118)
Caused by: java.lang.ClassNotFoundException: io.grpc.InternalGlobalInterceptors
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
The server startup code is:
server = Grpc.newServerBuilderForPort(port, InsecureServerCredentials.create())
.executor(Executors.newFixedThreadPool(16))
.addService(service)
.build();
Any idea what I need to change to resolve this?
Thanks!
Mike