sofastack-guides / sofa-ark-spring-guides

sofa-ark-spring-guides
15 stars 19 forks source link

项目打包后运行ark包报错 #37

Closed ochive closed 6 months ago

ochive commented 6 months ago

环境:

1.1.0 17 2.6.1 ### 打包配置 ```xml org.apache.maven.plugins maven-deploy-plugin true com.alipay.sofa sofa-ark-maven-plugin ${sofa.ark.version} default-cli repackage ``` ### 其他依赖 ```xml com.alipay.sofa sofa-ark-springboot-starter ${sofa.ark.version} com.alipay.sofa sofa-ark-all ${sofa.ark.version} com.alipay.sofa sofa-ark-api ${sofa.ark.version} com.alipay.sofa web-ark-plugin ${sofa.ark.version} ``` ## 现象 如果不使用ARK打包, 项目运行和打包后运行都是正常的. 使用ark将项目的依赖打包为ark plugin, 将项目打成ark包, 都是正常的. 直接使用IDEA启动项目(不加任何VM参数), 可以正常访问. 但是直接运行jar包就报错: ```powershell java "-Dsofa.ark.embed.enable=true" -jar ".\dataintegration-run-management-provider-1.0.0-SNAPSHOT-ark-executable.jar" ``` ```text java "-Dsofa.ark.embed.enable=true" -jar ".\dataintegration-run-management-provider-1.0.0-SNAPSHOT-ark-executable.jar" Exception in thread "main" java.lang.NoClassDefFoundError: com/alipay/sofa/ark/common/util/FileUtils at com.alipay.sofa.ark.bootstrap.BaseExecutableArchiveLauncher.createArchive(BaseExecutableArchiveLauncher.java:70) at com.alipay.sofa.ark.bootstrap.BaseExecutableArchiveLauncher.(BaseExecutableArchiveLauncher.java:42) at com.alipay.sofa.ark.bootstrap.ArkLauncher.(ArkLauncher.java:38) at com.alipay.sofa.ark.bootstrap.ArkLauncher.main(ArkLauncher.java:35) Caused by: java.lang.ClassNotFoundException: com.alipay.sofa.ark.common.util.FileUtils at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ... 4 more ```