Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 生成的Jar文件引发org.springframework.beans.factory.unsatifiedPendencyException异常_Java_Spring_Spring Boot_Maven_Spring Data Jpa - Fatal编程技术网

Java 生成的Jar文件引发org.springframework.beans.factory.unsatifiedPendencyException异常

Java 生成的Jar文件引发org.springframework.beans.factory.unsatifiedPendencyException异常,java,spring,spring-boot,maven,spring-data-jpa,Java,Spring,Spring Boot,Maven,Spring Data Jpa,我的整个应用程序在Eclipse中工作得非常好。我通过项目目录中的mvncleanpackage命令生成了一个jar文件。jar文件在目标文件夹中生成 现在我通过java-jarscoreextractionapp.jar执行这个jar文件,它给出了以下异常: ConfigServletWebServerApplicationContext:在上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans.factory.unsatifiedDependencyExc

我的整个应用程序在Eclipse中工作得非常好。我通过项目目录中的
mvncleanpackage
命令生成了一个jar文件。jar文件在目标文件夹中生成

现在我通过
java-jarscoreextractionapp.jar执行这个jar文件,它给出了以下异常:

ConfigServletWebServerApplicationContext:在上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans.factory.unsatifiedDependencyException:创建名为“appStartupRunner”的bean时出错:通过字段“scoreParserService”表示的未满足的依赖关系;嵌套异常为org.springframework.beans.factory.UnsatifiedDependencyException:创建名为“scoreParserServiceImpl”的bean时出错:通过字段“decisionAgentService”表示未满足的依赖关系;嵌套异常为org.springframework.beans.factory.beancreatitionException:创建名为“decisionAgentServiceImpl”的bean时出错,该名称在URL[jar:file:/D:/ScoreExtractionGitHub/ScoreExtraction/target/classes/ScoreExtractionApp.jar!/BOOT-INF/classes!/com/alraji/score/ScoreExtraction/service/impl/decisionAgentServiceImpl.class]中定义:合并bean定义后处理失败;嵌套异常为java.lang.IllegalStateException:未能从类加载器[org.springframework.boot.loader]中内省类[com.alraji.score.ScoreExtraction.service.impl.DecisionAgentServiceImpl]。LaunchedURLClassLoader@179d3b25]

下面是ScoreParserService接口

package com.alrajhi.score.ScoreExtraction.service;

import java.io.File;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

@Service
public interface ScoreParserService {

    public void startExecution();

    public List<File> getInputFiles(String workingDirectory);

    public void processInputFiles(List<File> files);
    
    public void saveLogOutputToDB(Date logDate, String logLevel, String logResult, String logType, String logUser, String runStatus,BigDecimal s);

 }

正如我在上面的评论中提到的,问题是在构建期间警告消息

[WARNING] Some problems were encountered while building the effective model for com.alrajhi.score:ScoreExtraction:jar:0.0.1

[WARNING] 'dependencies.dependency.systemPath' for com.experian.appscore:appscore:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/APPSCORE.jar will be unresolvable by dependent projects @ line 133, column 25

[WARNING] 'dependencies.dependency.systemPath' for com.experian.encoder:encoder:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/com.experian.eda.encoder-1.2.1.EDA2-bundle.jar will be unresolvable by dependent projects @ line 142, column 25

[WARNING] 'dependencies.dependency.systemPath' for com.experian.eda.da:Decision.Agent.Bundle:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/DA.jar will be unresolvable by dependent projects @ line 151, column 25

[WARNING] 'dependencies.dependency.systemPath' for org.grlea.Bridge:Log.Bridge:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/log-bridge-1.0.jar will be unresolvable by dependent projects @ line 160, column 25
这些警告消息的解决方案是将这些jar文件包含在我本地的mevan存储库中。
正如我在上面的评论中提到的,这个问题是在构建过程中警告消息

[WARNING] Some problems were encountered while building the effective model for com.alrajhi.score:ScoreExtraction:jar:0.0.1

[WARNING] 'dependencies.dependency.systemPath' for com.experian.appscore:appscore:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/APPSCORE.jar will be unresolvable by dependent projects @ line 133, column 25

[WARNING] 'dependencies.dependency.systemPath' for com.experian.encoder:encoder:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/com.experian.eda.encoder-1.2.1.EDA2-bundle.jar will be unresolvable by dependent projects @ line 142, column 25

[WARNING] 'dependencies.dependency.systemPath' for com.experian.eda.da:Decision.Agent.Bundle:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/DA.jar will be unresolvable by dependent projects @ line 151, column 25

[WARNING] 'dependencies.dependency.systemPath' for org.grlea.Bridge:Log.Bridge:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/log-bridge-1.0.jar will be unresolvable by dependent projects @ line 160, column 25
这些警告消息的解决方案是将这些jar文件包含在我本地的mevan存储库中。
我是这样想的

Bean创建失败了,因为组件没有被扫描。您需要添加注释@ComponentScan当从Eclipse运行时,您使用的Java版本是否与运行打包JAR时相同?在Eclipse中,它由Java“1.8.0_11”运行,在Eclipse之外,我有两个Java版本“1.8.0_221”和“1.8.0_11”。我执行了java版本“1.8.0_11”生成的jar文件,它给出了相同的结果,您需要在AppStartupRunner中放入@ComponentScan,因为您已经需要为相同的文件放入基本包引用和包引用。参考:Bean创建失败,因为未扫描组件。您需要添加注释@ComponentScan当从Eclipse运行时,您使用的Java版本是否与运行打包JAR时相同?在Eclipse中,它由Java“1.8.0_11”运行,在Eclipse之外,我有两个Java版本“1.8.0_221”和“1.8.0_11”。我执行了java版本“1.8.0_11”生成的jar文件,它给出了相同的结果,您需要在AppStartupRunner中放入@ComponentScan,因为您已经需要为相同的文件放入基本包引用和包引用。参考文献:
[WARNING] Some problems were encountered while building the effective model for com.alrajhi.score:ScoreExtraction:jar:0.0.1

[WARNING] 'dependencies.dependency.systemPath' for com.experian.appscore:appscore:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/APPSCORE.jar will be unresolvable by dependent projects @ line 133, column 25

[WARNING] 'dependencies.dependency.systemPath' for com.experian.encoder:encoder:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/com.experian.eda.encoder-1.2.1.EDA2-bundle.jar will be unresolvable by dependent projects @ line 142, column 25

[WARNING] 'dependencies.dependency.systemPath' for com.experian.eda.da:Decision.Agent.Bundle:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/DA.jar will be unresolvable by dependent projects @ line 151, column 25

[WARNING] 'dependencies.dependency.systemPath' for org.grlea.Bridge:Log.Bridge:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/log-bridge-1.0.jar will be unresolvable by dependent projects @ line 160, column 25