解决jar包中的类存在但是运行报NoClassDefFoundError错误
错误如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.base.controller.ZhimaController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.base.api.ZhimaService com.base.controller.ZhimaController.zhimaService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘zhimaServiceImpl’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.base.zhima.api.ZhiMaService com.base.impl.ZhimaServiceImpl.zhiMaService; nested exception is java.lang.NoClassDefFoundError: com/antgroup/zmxy/openplatform/api/ZhimaApiException
解决方案:
在文件夹中找到对应的jar包,复制粘贴到项目的web/target/WEB-INF/lib目录下