apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.5k stars 26.43k forks source link

[Bug] 3.2.13 has compatibility issues with Spring boot 3.2+. #14295

Open maiyuanrdt opened 5 months ago

maiyuanrdt commented 5 months ago

Pre-check

Search before asking

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

Dubbo Java 3.2.13, Java Corretto 17/21, Windows 11

Steps to reproduce this issue

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.3.0'
    id 'io.spring.dependency-management' version '1.1.5'
}

group = 'com.xxx.xxx'
version = '0.0.1-SNAPSHOT'

repositories {
    mavenCentral()
}

ext {
    dubboVersion = "3.2.13"
}

dependencyManagement {
    imports {
        mavenBom "org.apache.dubbo:dubbo-bom:${dubboVersion}"
    }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-graphql'
    implementation 'org.springframework.boot:spring-boot-starter-webflux'

    implementation "org.apache.dubbo:dubbo"
}

After executing the build task, the following error is reported through java -jar build/libs/*-0.0.1-SNAPSHOT.jar

C:\Users\DELL\.jdks\corretto-17.0.11\bin\java.exe -Dfile.encoding=UTF-8 -jar D:\Projects\demo\build\libs\demo-0.0.1-SNAPSHOT.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91)
    at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53)
    at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58)
Caused by: java.lang.StringIndexOutOfBoundsException: begin 18, end -1, length 28
    at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4606)
    at java.base/java.lang.String.substring(String.java:2709)
    at org.springframework.boot.loader.jar.MetaInfVersionsInfo.get(MetaInfVersionsInfo.java:85)
    at org.springframework.boot.loader.jar.MetaInfVersionsInfo.get(MetaInfVersionsInfo.java:69)
    at org.springframework.boot.loader.zip.ZipContent.lambda$getInfo$0(ZipContent.java:326)
    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
    at org.springframework.boot.loader.zip.ZipContent.getInfo(ZipContent.java:324)
    at org.springframework.boot.loader.jar.NestedJarFile.getMetaInfVersionsInfo(NestedJarFile.java:337)
    at org.springframework.boot.loader.jar.NestedJarFile.getVersionedContentEntry(NestedJarFile.java:279)
    at org.springframework.boot.loader.jar.NestedJarFile.hasEntry(NestedJarFile.java:247)
    at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.hasEntry(JarUrlClassLoader.java:170)
    at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.definePackage(JarUrlClassLoader.java:144)
    at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.definePackageIfNecessary(JarUrlClassLoader.java:125)
    at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:98)
    at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
    at com.example.demo.DemoApplication.main(DemoApplication.java:10)
    ... 7 more

What you expected to happen

3.2.13 has compatibility issues with Spring boot 3.2+. After downgrading to 3.2.12, it can be normal

Anything else

No response

Are you willing to submit a pull request to fix on your own?

Code of Conduct

wcy666103 commented 5 months ago

Was it successful to run the case in the ide without running the jar directly? In addition, if you want to package it into a runnable jar package, you need to use the dubbo-maven-plugin plugin. For details, see this example:

https://github.com/apache/dubbo-samples/tree/master/2-advanced/dubbo-samples-native-image

guyangxizhao commented 5 months ago

我也出现了同样的问题, idea 或者使用 mvn spring-boot:run 都能正常运行, mvn clean package 能成功,运行时报上面的错误

![Uploading 屏幕截图 2024-06-11 123521.png…]()

MrLiuFang commented 5 months ago

确实存在这个问题 打包后无法运行

MrLiuFang commented 5 months ago

确实存在这个问题 打包后无法运行

wcy666103 commented 5 months ago

It's because of this:

https://github.com/spring-projects/spring-boot/issues/41001

https://github.com/apache/dubbo/pull/14247

Wait for the new release to solve