sofastack-guides / spring-boot-ark-biz

0 stars 8 forks source link

运行executable.jar 报ArkConfigs NoClassDefFoundError 异常 #3

Closed jjj124 closed 1 year ago

jjj124 commented 2 years ago
1.8 2.0.0
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.12</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>com.alipay.sofa</groupId>
            <artifactId>sofa-ark-maven-plugin</artifactId>
            <version>${sofa.ark.version}</version>
            <executions>
                <execution>
                    <id>default-cli</id>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <skipArkExecutable>false</skipArkExecutable>
                <outputDirectory>./target</outputDirectory>
                <bizName>plugin-ark-biz</bizName>
                <webContextPath>biz</webContextPath>
            </configuration>
        </plugin>
    </plugins>
</build>
jjj124 commented 2 years ago
2.0.0 使用2.0.0 版本
jjj124 commented 2 years ago
public Object launch(String[] args) throws Exception {
    if (!ArkConfigs.isEmbedEnable()) {
        JarFile.registerUrlProtocolHandler();
    }
    ClassLoader classLoader = createContainerClassLoader(getContainerArchive());
    List<String> attachArgs = new ArrayList<>();
    attachArgs
        .add(String.format("%s%s=%s", CommandArgument.ARK_CONTAINER_ARGUMENTS_MARK,
            CommandArgument.FAT_JAR_ARGUMENT_KEY, getExecutableArchive().getUrl()
                .toExternalForm()));
    attachArgs.addAll(Arrays.asList(args));
    return launch(attachArgs.toArray(new String[attachArgs.size()]), getMainClass(),
        classLoader);
}

发现ArkConfigs 这个类没有被打包在根目录

lvjing2 commented 2 years ago

麻烦拉下最新代码试下,感谢。