Код: Выделить всё
io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2Exception: HTTP/2 client preface string missing or corrupt. Hex dump for received bytes: 16030100900100008c0303eff886b61e9c20b771f4bc630e
at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:109) ~[grpc-netty-shaded-1.63.0.jar:1.63.0]
at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.readClientPrefaceString(Http2ConnectionHandler.java:321) ~[grpc-netty-shaded-1.63.0.jar:1.63.0]
at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:247) ~[grpc-netty-shaded-1.63.0.jar:1.63.0]......
io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2Exception: HTTP/2 client preface string missing or corrupt. Hex dump for received bytes: 16030100900100008c03030f1f98375f8a92344de7e5a25b
at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:109) ~[grpc-netty-shaded-1.63.0.jar:1.63.0]
at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.readClientPrefaceString(Http2ConnectionHandler.java:321) ~[grpc-netty-shaded-1.63.0.jar:1.63.0]...
Конфигурация Gradle:
Код: Выделить всё
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.1'
id 'io.spring.dependency-management' version '1.1.6'
id 'com.google.protobuf' version '0.9.4'
}
group = 'org.practice'
version = '0.0.1-SNAPSHOT'
def protobufVersion = '3.25.4'
def grpcVersion = '1.63.0'
def osVersion = 'windows-x86_64'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation "net.devh:grpc-spring-boot-starter:3.1.0.RELEASE"
// implementation "net.devh:grpc-client-spring-boot-starter:3.1.0.RELEASE"
implementation "net.devh:grpc-server-spring-boot-starter:3.1.0.RELEASE"
implementation 'io.netty:netty-tcnative-boringssl-static:2.0.54.Final'
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
compileOnly 'jakarta.annotation:jakarta.annotation-api:1.3.5'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protobufVersion}"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
sourceSets {
main {
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
}
}
}
tasks.named('test') {
useJUnitPlatform()
}
Код: Выделить всё
spring.profiles.active=dev
#grpc.client.Global.negotiation-type=plaintext
#
#grpc.server.in-process-name=grpcproj
#grpc.server.security.enabled=true
#grpc.server.security.certificateChain=classpath:certificates/server.crt
#grpc.server.security.privateKey=classpath:certificates/server.key
#
#grpc.client.inProcess.address=grpcproj
Что я пробовал:
- Убедиться, что порты сервера и клиента совпадают (в данном случае 50051)
- Установить тип согласования на открытый текст как для клиента, так и для клиента. сервер
- Проверка использования совместимых версий gRPC и Spring Boot
- Смена версий, отключение антивируса и многое другое
- Проверка того, что я использую совместимые версии gRPC и Spring Boot
- Смена версий, отключение антивируса и многое другое
- li>
- Что может быть причиной этой ошибки строки предисловия HTTP/2?< /li>
Есть ли какие-либо проблемы с конфигурацией в моей настройке, которые могут привести к этой проблеме? - Как устранить неполадки и устранить эту ошибку?
Подробнее здесь: https://stackoverflow.com/questions/788 ... pplication