大家好我是图恩,最近在优化后端服务代码的时候引入了第三方jar包,本地开发调试的时候一切正常,通过package命令打包后再通过-jar命令启动的时候启动报错,提示一下错误信息:
Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class
[com.dsiab.manageService.controller.PromoteController] from ClassLoader ...
pom.xml文件代码如下,jar包文件放在resource目录下。
\n<dependency>\n <groupId>com.dsiab</groupId>\n <artifactId>dsiab</artifactId>\n <scope>system</scope>\n <version>1.0</version>\n <systemPath>${basedir}/src/main/resources/lib/xxx.jar</systemPath>\n</dependency>最终解决办法就是在pom文件中的build配置中加入includeSystemScope命令
<build>\n <plugins>\n <plugin>\n <groupId>org.springframework.boot</groupId>\n <artifactId>spring-boot-maven-plugin</artifactId>\n <version>2.6.5</version>\n <!-- 打包时可以通过jar命令单独运行 -->\n <executions>\n <execution>\n <goals>\n <goal>\n repackage\n </goal>\n </goals>\n </execution>\n </executions>\n <!--加入这个includeSystemScope,解决引入第三方包后本地运行正常,打包后报错问题-->\n <configuration>\n <includeSystemScope>true</includeSystemScope>\n </configuration>\n </plugin>\n </plugins>\n </build>\n