grpc-spring icon indicating copy to clipboard operation
grpc-spring copied to clipboard

The gRPC server does not start, Java

Open Aberkingaliev opened this issue 2 years ago • 5 comments

Labeled the class with the annotation @GrpcServer

@GrpcService
public class UserService extends UserGrpc.UserImplBase {...code}

I'm using it together with spring boot web.

Gradle dependencies:

dependencies {
implementation 'net.devh:grpc-server-spring-boot-starter:2.14.0.RELEASE'
implementation 'net.devh:grpc-server-spring-boot-autoconfigure:2.14.0.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.postgresql:postgresql:42.6.0'
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation 'org.flywaydb:flyway-core'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.grpc:grpc-testing:1.57.2'
}

There is nothing about gRPC in the startup logs, no error or useful information, not even in DEBUG level

Aberkingaliev avatar Aug 28 '23 17:08 Aberkingaliev

Perhaps something else is needed besides the @GrpcService annotation and extension?

Aberkingaliev avatar Aug 28 '23 18:08 Aberkingaliev

Nothing more. The question is which version of Spring Boot do you use?

piomin avatar Aug 29 '23 09:08 piomin

Was using the latest version of Spring boot Then I decided to roll back to 2.6.13 Everything worked, apparently there is no support for newer versions of Spring.

Aberkingaliev avatar Aug 29 '23 16:08 Aberkingaliev

Actually it is. You have to add @ImportAutoConfiguration(GrpcClientAutoConfiguration.class) to your configuration. Current version of the starter do not have autoconfiguration file in format supported from 2.7, and old one is not supported since 3.0.

marcindabrowski avatar Sep 13 '23 08:09 marcindabrowski

@Aberkingaliev see https://github.com/yidongnan/grpc-spring-boot-starter/issues/778#issuecomment-1569362944 , full context: https://github.com/yidongnan/grpc-spring-boot-starter/issues/953

FyiurAmron avatar Sep 18 '23 16:09 FyiurAmron