Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

java.lang.NoClassDefFoundError with latest grpc plugin #90

Open
bcarter97 opened this issue Jan 26, 2024 · 0 comments
Open

java.lang.NoClassDefFoundError with latest grpc plugin #90

bcarter97 opened this issue Jan 26, 2024 · 0 comments

Comments

@bcarter97
Copy link

Describe the bug

In scalapb-runtime 0.11.15 we are seeing the following error:

[error] Test suite failed with java.lang.NoClassDefFoundError: io/grpc/internal/AbstractManagedChannelImplBuilder.
[error] This may be due to the ClassLoaderLayeringStrategy (ScalaLibrary) used by your task.
[error] To improve performance and reduce memory, sbt attempts to cache the class loaders used to load the project dependencies.
[error] The project class files are loaded in a separate class loader that is created for each test run.
[error] The test class loader accesses the project dependency classes using the cached project dependency classloader.
[error] With this approach, class loading may fail under the following conditions:
[error] 
[error]  * Dependencies use reflection to access classes in your project's classpath.
[error]    Java serialization/deserialization may cause this.
[error]  * An open package is accessed across layers. If the project's classes access or extend
[error]    jvm package private classes defined in a project dependency, it may cause an IllegalAccessError
[error]    because the jvm enforces package private at the classloader level.
[error] 
[error] These issues, along with others that were not enumerated above, may be resolved by changing the class loader layering strategy.
[error] The Flat and ScalaLibrary strategies bundle the full project classpath in the same class loader.
[error] To use one of these strategies, set the  ClassLoaderLayeringStrategy key
[error] in your configuration, for example:
[error] 
[error] set classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.ScalaLibrary
[error] set classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
[error] 
[error] See ClassLoaderLayeringStrategy.scala for the full list of options.

To Reproduce

use gatling-grpc with a newer version of sbt-protoc compilerplugin

Other context

AbstractManagedChannelImplBuilder was removed in grpc-java 1.59.0 - https://github.com/grpc/grpc-java/releases/tag/v1.59.0

This was updated in scalapb in scalapb/ScalaPB#1598 which scalapb-runtime uses

Is this just a case of updating the compilerplugin to the latest?

libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.11"

Additionally I can see sbt-protoc has an update for 1.0.7, would it make sense to update that too?

addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant