Skip to content

Commit 5573e74

Browse files
authored
Merge pull request #524 from yidongnan/docs/trouble/version-mismatch
Add a version mismatch section to the docs trouble shooting section
2 parents cff64fb + 45bca15 commit 5573e74

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

docs/en/trouble-shooting.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ are also affected. If there is no such topic, feel free to open a new one as des
99

1010
## Table of Contents
1111

12+
- [NoClassDefFoundError, ClassNotFoundException, NoSuchMethodError, AbstractMethodError](#noclassdeffounderror-classnotfoundexception-nosuchmethoderror-abstractmethoderror)
1213
- [Transport failed](#transport-failed)
1314
- [Network closed for unknown reason](#network-closed-for-unknown-reason)
1415
- [Could not find TLS ALPN provider](#could-not-find-tls-alpn-provider)
@@ -18,6 +19,52 @@ are also affected. If there is no such topic, feel free to open a new one as des
1819
- [Client fails to resolve domain name](#client-fails-to-resolve-domain-name)
1920
- [Creating issues / asking questions](#creating-issues)
2021

22+
## NoClassDefFoundError, ClassNotFoundException, NoSuchMethodError, AbstractMethodError
23+
24+
### Example
25+
26+
````txt
27+
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in file [~/.../MyGrpcClient.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: io/grpc/TlsChannelCredentials$Feature
28+
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)
29+
[...]
30+
Caused by: java.lang.NoClassDefFoundError: io/grpc/TlsChannelCredentials$Feature
31+
at io.grpc.netty.ProtocolNegotiators.<clinit>(ProtocolNegotiators.java:92)
32+
````
33+
34+
### The Problem
35+
36+
The server/client does not start because some class or method is missing. \
37+
This is usually the case if the grpc-libraries use slightly different versions.
38+
39+
### The solution
40+
41+
Make sure to use exactly the same version for all `grpc-java` versions.
42+
43+
Add the following entry to your `dependencyManagement` section of your project:
44+
45+
````xml
46+
<dependency>
47+
<groupId>io.grpc</groupId>
48+
<artifactId>grpc-bom</artifactId>
49+
<version>${grpcVersion}</version>
50+
<type>pom</type>
51+
<scope>import</scope>
52+
</dependency>
53+
````
54+
55+
You can use a similar approach for gradle:
56+
57+
````groovy
58+
dependencyManagement {
59+
imports {
60+
mavenBom "io.grpc:grpc-bom:${grpcVersion}"
61+
````
62+
63+
> **Note:** grpc-spring-boot-starter isn't strictly bound to a specific version of grpc-java, so you can also use this
64+
> to change the version of grpc-java you are using in your project.
65+
66+
See also [Could not find TLS ALPN provider](#could-not-find-tls-alpn-provider)
67+
2168
## Transport failed
2269

2370
### Server-side

0 commit comments

Comments
 (0)