Skip to content

Classes and resources with a single letter component in their package name cannot be loaded from jar files with /./ or /../ in their path #17341

@bes2008

Description

@bes2008

our project load mysql 8 class fail:

loadmysqlfail

package config:

<plugin>
      <groupId>org.spring.framework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <executions>
             <execution>
                    <goals>
                         <goal>repackage</goal>
                    </goals>
             </execution>
      </executions>
      <configuration>
            <mainClass>our main class</mainClass>
            <layout>ZIP</layout>
            <excludes>
                  <exclude>
                         <groupId>mysql</groupId>
                         <artifactId>mysql-connector-java</artifactId>
                  </exclude>
            </excludes>
      </configuration>
</plugin>

project dist directory:

/--bin/
 --config/
 --lib/
     --drivers/
          -- mysql-connector-java-8.0.15.jar
     --bootstrap.jar
 --scripts/

by debug, I found when load 'com/mysql/cj/protocol/a/result/NativeResultset.class',
the spring boot custom URLStremHandler (org/springframework/boot/loader/jar/Handler.java
Handler.java ) will parse 'com/mysql/cj/protocol/a/result/NativeResultset.class' as 'com/mysql/cj/protocol/result/NativeResultset.class' 。

In other words, every single letter directory will be parse as empty string "";

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions