Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to bootstrap grpc DocService, may cause by protobuf remove some field and method #5955

Open
HongYunCloud opened this issue Oct 24, 2024 · 1 comment

Comments

@HongYunCloud
Copy link

dependencies {
    api("io.grpc:grpc-stub:1.68.0")
    api("io.grpc:grpc-protobuf:1.68.0")
    api("com.google.protobuf:protobuf-java:4.28.2")
    api("com.google.protobuf:protobuf-java-util:4.28.2")

    // armeria with version 2.5.0, but it's version is not compatible with protobuf, due to the following error:
    // Exception in thread "main" java.lang.IllegalAccessError: class org.curioswitch.common.protobuf.json.ProtobufUtil tried to access method 'boolean com.google.protobuf.Descriptors$FieldDescriptor.hasOptionalKeyword()' (org.curioswitch.common.protobuf.json.ProtobufUtil and com.google.protobuf.Descriptors$FieldDescriptor are in unnamed module of loader 'app')
    //	at org.curioswitch.common.protobuf.json.ProtobufUtil.hasOptionalKeyword(ProtobufUtil.java:306)
    api("org.curioswitch.curiostack:protobuf-jackson:2.6.0")
}
Exception in thread "main" java.util.ServiceConfigurationError: com.linecorp.armeria.server.docs.DocServicePlugin: Provider com.linecorp.armeria.internal.server.grpc.GrpcDocServicePlugin could not be instantiated
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813)
	at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729)
	at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
	at com.linecorp.armeria.internal.shaded.guava.collect.ImmutableList.copyOf(ImmutableList.java:279)
	at com.linecorp.armeria.internal.shaded.guava.collect.ImmutableList.copyOf(ImmutableList.java:240)
	at com.linecorp.armeria.server.docs.DocService.<clinit>(DocService.java:105)
	at bot.inker.asteroid.core.AsteroidArmeriaServer.server(AsteroidArmeriaServer.java:30)
	at bot.inker.asteroid.core.AsteroidArmeriaServer.start(AsteroidArmeriaServer.java:63)
	at bot.inker.asteroid.core.AsteroidBotFramework.main(AsteroidBotFramework.java:11)
Caused by: java.lang.NoSuchMethodError: 'com.google.protobuf.util.JsonFormat$Printer com.google.protobuf.util.JsonFormat$Printer.includingDefaultValueFields()'
	at com.linecorp.armeria.internal.server.grpc.GrpcDocServicePlugin.<clinit>(GrpcDocServicePlugin.java:96)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1319)
	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:300)
	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newConstructorAccessor(MethodHandleAccessorFactory.java:103)
	at java.base/jdk.internal.reflect.ReflectionFactory.newConstructorAccessor(ReflectionFactory.java:200)
	at java.base/java.lang.reflect.Constructor.acquireConstructorAccessor(Constructor.java:549)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789)
	... 8 more
@minwoox
Copy link
Member

minwoox commented Oct 24, 2024

I believe that Armeria doens't support Protobuf 4.x version yet. Would you mind trying with the versions that Armeria uses?
https://github.com/line/armeria/blob/main/dependencies.toml#L42
https://github.com/line/armeria/blob/main/dependencies.toml#L119

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

No branches or pull requests

2 participants