Skip to content

Uber jar fails to start when it contains a dependency with Multi-Release: true in its manifest and unexpected file entries in META-INF/versions #41001

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

Closed
houkunlin opened this issue Jun 6, 2024 · 6 comments
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@houkunlin
Copy link

idea 2024.1
gradle 8.8
gradle plugins org.springframework.boot 3.3.0
gradle plugins io.spring.dependency-management 1.1.5

java -jar .\startup-application.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 43
        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.houkunlin.cloud.micro.AllInOneServerApplication.main(AllInOneServerApplication.java:34)
        ... 7 more

Unzip startup-application.jar to test folder, then cd test exec java -cp . -Xdebug -Xnoagent org.springframework.boot.loader.launch.JarLauncher is ok

@houkunlin houkunlin changed the title who can help me. java can't start springboot 3.3.0 jar application, console ablout MetaInfVersionsInfo error who can help me. java can't start springboot 3.3.0 jar application, console about MetaInfVersionsInfo error Jun 6, 2024
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 6, 2024
@houkunlin
Copy link
Author

It looks like the path content of META-INF/versions/ in one of my dependency jars is incomplete. I am currently checking my dependency list.

@houkunlin
Copy link
Author

At present, it is found that the META-INF/versions/ path of dubbo-3.2.13.jar is suspected to not meet the conditional content of

, resulting in a -1 value.

@wilkinsona
Copy link
Member

wilkinsona commented Jun 6, 2024

Thanks, @houkunlin. That's exactly it. The code expects entries beneath META-INF/versions/ to be of the form META-INF/versions/<number>/*. The Apache Dubbo 3.2.13 jar has several entries that don't match this expectation:

     3077  04-01-2020 08:04   META-INF/versions/.artifacts
       89  04-01-2020 08:04   META-INF/versions/dubbo
       97  04-01-2020 08:04   META-INF/versions/dubbo-cluster
       96  04-01-2020 08:04   META-INF/versions/dubbo-common
      100  04-01-2020 08:04   META-INF/versions/dubbo-compatible
      100  04-01-2020 08:04   META-INF/versions/dubbo-config-api
      103  04-01-2020 08:04   META-INF/versions/dubbo-config-spring
      112  04-01-2020 08:04   META-INF/versions/dubbo-configcenter-zookeeper
      109  04-01-2020 08:04   META-INF/versions/dubbo-configcenter-apollo
      108  04-01-2020 08:04   META-INF/versions/dubbo-configcenter-nacos
      103  04-01-2020 08:04   META-INF/versions/dubbo-container-api
      106  04-01-2020 08:04   META-INF/versions/dubbo-container-spring
      102  04-01-2020 08:04   META-INF/versions/dubbo-filter-cache
      107  04-01-2020 08:04   META-INF/versions/dubbo-filter-validation
      102  04-01-2020 08:04   META-INF/versions/dubbo-metadata-api
      115  04-01-2020 08:04   META-INF/versions/dubbo-metadata-report-zookeeper
      111  04-01-2020 08:04   META-INF/versions/dubbo-metadata-report-nacos
      111  04-01-2020 08:04   META-INF/versions/dubbo-metadata-report-redis
      118  04-01-2020 08:04   META-INF/versions/dubbo-metadata-definition-protobuf
      101  04-01-2020 08:04   META-INF/versions/dubbo-metrics-api
      105  04-01-2020 08:04   META-INF/versions/dubbo-metrics-default
      106  04-01-2020 08:04   META-INF/versions/dubbo-metrics-registry
      108  04-01-2020 08:04   META-INF/versions/dubbo-metrics-prometheus
      106  04-01-2020 08:04   META-INF/versions/dubbo-metrics-metadata
      111  04-01-2020 08:04   META-INF/versions/dubbo-metrics-config-center
      101  04-01-2020 08:04   META-INF/versions/dubbo-monitor-api
      105  04-01-2020 08:04   META-INF/versions/dubbo-monitor-default
       94  04-01-2020 08:04   META-INF/versions/dubbo-auth
       97  04-01-2020 08:04   META-INF/versions/dubbo-qos-api
       93  04-01-2020 08:04   META-INF/versions/dubbo-qos
       98  04-01-2020 08:04   META-INF/versions/dubbo-security
       98  04-01-2020 08:04   META-INF/versions/dubbo-reactive
      105  04-01-2020 08:04   META-INF/versions/dubbo-spring-security
      102  04-01-2020 08:04   META-INF/versions/dubbo-registry-api
      108  04-01-2020 08:04   META-INF/versions/dubbo-registry-multicast
      107  04-01-2020 08:04   META-INF/versions/dubbo-registry-multiple
      104  04-01-2020 08:04   META-INF/versions/dubbo-registry-nacos
      108  04-01-2020 08:04   META-INF/versions/dubbo-registry-zookeeper
      102  04-01-2020 08:04   META-INF/versions/dubbo-remoting-api
      103  04-01-2020 08:04   META-INF/versions/dubbo-remoting-http
      104  04-01-2020 08:04   META-INF/versions/dubbo-remoting-netty
      105  04-01-2020 08:04   META-INF/versions/dubbo-remoting-netty4
      108  04-01-2020 08:04   META-INF/versions/dubbo-remoting-zookeeper
      117  04-01-2020 08:04   META-INF/versions/dubbo-remoting-zookeeper-curator5
       97  04-01-2020 08:04   META-INF/versions/dubbo-rpc-api
       99  04-01-2020 08:04   META-INF/versions/dubbo-rpc-dubbo
       99  04-01-2020 08:04   META-INF/versions/dubbo-rpc-injvm
       98  04-01-2020 08:04   META-INF/versions/dubbo-rpc-rest
      100  04-01-2020 08:04   META-INF/versions/dubbo-rpc-triple
      107  04-01-2020 08:04   META-INF/versions/dubbo-serialization-api
      112  04-01-2020 08:04   META-INF/versions/dubbo-serialization-hessian2
      113  04-01-2020 08:04   META-INF/versions/dubbo-serialization-fastjson2
      107  04-01-2020 08:04   META-INF/versions/dubbo-serialization-jdk

MetaInfVersionsInfo needs to be updated to tolerate these unexpected entries by ignoring them.

@wilkinsona wilkinsona changed the title who can help me. java can't start springboot 3.3.0 jar application, console about MetaInfVersionsInfo error Uber jar fails to start when it contains a dependency with file entries in META-INF/versions Jun 6, 2024
@wilkinsona wilkinsona changed the title Uber jar fails to start when it contains a dependency with file entries in META-INF/versions Uber jar fails to start when it contains a dependency with file entries in META-INF/versions Jun 6, 2024
@wilkinsona wilkinsona added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 6, 2024
@wilkinsona wilkinsona added this to the 3.2.x milestone Jun 6, 2024
@houkunlin
Copy link
Author

houkunlin commented Jun 6, 2024

It was found that the previous version 3.2.3 was running normally. During this period, this check code did not seem to have changed.

2024-06-06T19:33:46.348+08:00  INFO 72676 --- [all-in-one-server] [           main] d.s.b.c.e.WelcomeLogoApplicationListener :  [DUBBO]

 :: Dubbo (v3.2.11) : https://github.com/apache/dubbo
 :: Discuss group : dev@dubbo.apache.org
, dubbo version: 3.2.11, current host: 127.0.0.1
2024-06-06T19:33:46.375+08:00  WARN 72676 --- [all-in-one-server] [           main] c.a.nacos.client.logging.NacosLogging    : Load Logback Configuration of Nacos fail, message: Could not initialize Logback Nacos logging from classpath:nacos-logback.xml

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.3)
gradle 7.5.x
gradle plugins org.springframework.boot 3.2.3
gradle plugins io.spring.dependency-management 1.1.4

@wilkinsona wilkinsona changed the title Uber jar fails to start when it contains a dependency with file entries in META-INF/versions Uber jar fails to start when it contains a dependency with Multi-Release: true in its manifest and unexpected file entries in META-INF/versions Jun 6, 2024
@wilkinsona
Copy link
Member

You're using a different version of Apache Dubbo there. 3.2.11 does not have Multi-Release: true in its manifest but 3.2.13 does. As a result of this different, you won't see the problem with 3.2.11.

@wilkinsona wilkinsona self-assigned this Jun 6, 2024
@houkunlin
Copy link
Author

Got it, thanks @wilkinsona

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

3 participants