Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.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 异常org.springframework.beans.factory.BeanCreationException:引发持久性依赖项注入失败_Java_Spring_Spring Boot - Fatal编程技术网

Java 异常org.springframework.beans.factory.BeanCreationException:引发持久性依赖项注入失败

Java 异常org.springframework.beans.factory.BeanCreationException:引发持久性依赖项注入失败,java,spring,spring-boot,Java,Spring,Spring Boot,我有一个使用Spring和maven构建在单独jar中的模块。 Spring和其他库位于jar文件之外的单独文件夹中。 一般来说,情况如下: 目标 |--解放党 |--updater.jar 问题是,当我使用以下命令运行这个jar时 java-jar updater-1.jar com.updater.config.Application 它开始执行,但停止时出现以下异常: 顺便说一句:只有当我从生成的jar文件运行应用程序时才会引发异常。如果我从IDE Intellij运行它,Idea应用程序

我有一个使用Spring和maven构建在单独jar中的模块。 Spring和其他库位于jar文件之外的单独文件夹中。 一般来说,情况如下:

目标 |--解放党 |--updater.jar

问题是,当我使用以下命令运行这个jar时 java-jar updater-1.jar com.updater.config.Application 它开始执行,但停止时出现以下异常:

顺便说一句:只有当我从生成的jar文件运行应用程序时才会引发异常。如果我从IDE Intellij运行它,Idea应用程序将正常工作,没有此异常

包com.updater.config; @配置 @启用自动配置 @使能调度 @ComponentScanbasePackages=com.updater //无法按相对路径读取外部属性 @PropertySourcename=external1,value=file:external.properties, ignoreResourceNotFound=true @导入{PersistenceConfig.class} 公共类应用程序{ 公共静态无效字符串[]args{ SpringApplication.runApplication.class,args; } } 调度程序:

包com.updater.config; @组成部分 公共类ScheduledTask{ @自动连线 私人环境署; @自动连线 私有更新管理器更新管理器; ... } 更新管理器:

包com.updater.manager; @组成部分 公共类更新管理器{ @自动连线 私有变更服务变更服务; @自动连线 私人的,私人的,私人的,私人的; ... } 通用报告:

包com.updater.persistence.repository; @组成部分 公共类公共报告{ @Valuevalue=${identity.insert.enable.sql:} 私有字符串标识InsertEnableSQL; @值${identity.insert.disable.sql:} 私有字符串标识InSertDisableSQL; @持久上下文 私人实体管理者实体管理者; ... } pom.xml

罐子 org.springframework.boot 弹簧靴起动器 ${spring启动版本} org.springframework.data spring数据jpa ${spring data.version} org.springframework spring上下文 4.0.8.1发布 ... org.apache.maven.plugins maven jar插件 符合事实的 符合事实的 解放党 ${start class} ... 生成的Manifest.MF

Manifest-Version: 1.0
Implementation-Title: updater
Implementation-Version: 1
Archiver-Version: Plexus Archiver
Built-By: Author
Specification-Vendor: SoftwareEntwicklung Beratung Schulung
groupId: com.updater.service
Specification-Title: updater
Implementation-Vendor-Id: com.updater.service
Class-Path: 
    lib/jsr305-2.0.1.jar 
    lib/spring-boot-starter-1.1.9.RELEASE.jar 
    lib/spring-boot-1.1.9.RELEASE.jar 
    lib/spring-boot-autoconfigure-1.1.9.RELEASE.jar 
    lib/spring-boot-starter-logging-1.1.9.RELEASE.jar  
    lib/spring-core-4.0.8.RELEASE.jar 
    lib/hibernate-entitymanager-4.3.6.Final.jar 
    lib/spring-data-jpa-1.7.0.RELEASE.jar 
    lib/spring-data-commons-1.9.0.RELEASE.jar 
    lib/spring-orm-4.0.7.RELEASE.jar 
    lib/spring-jdbc-4.0.7.RELEASE.jar 
    lib/spring-aop-4.0.7.RELEASE.jar 
    lib/aopalliance-1.0.jar 
    lib/spring-tx-4.0.7.RELEASE.jar 
    lib/spring-beans-4.0.7.RELEASE.jar 
    ...
version: 1
Implementation-Vendor: SoftwareEntwicklung Beratung Schulung
Main-Class: com.updater.config.Application
artifactId: updater
Created-By: Apache Maven 3.2.5
Build-Jdk: 1.8.0_31
Specification-Version: 1
更新

为了更好地理解发生了什么,我别无选择,比如调试产生此异常的Spring

我发现执行app gtom IDE和作为单独的jar在初始化方面有一些不同

春天使一些工厂负荷过重

而且URL变量也有一些不同

顶部是IDE调试 底部是远程jar调试

因此,一些罐子不被考虑。 看起来是类路径的问题。但对我来说,清单是正确的


现在我不知道下一步该去哪里。

您是否使用任何解压器打开updater.jar并验证了各自的依赖项jarsin清单是否包含在jar中的正确路径中?谢谢您的回复。但是带有libs的文件夹在jar文件之外。由于updater.jar和libs位于同一级别,清单包含以下行作为类路径:lib/spring-boot-1.1.9.RELEASE.jar。因为autoupdate,所以分离libs和updater.jar是个好主意
Manifest-Version: 1.0
Implementation-Title: updater
Implementation-Version: 1
Archiver-Version: Plexus Archiver
Built-By: Author
Specification-Vendor: SoftwareEntwicklung Beratung Schulung
groupId: com.updater.service
Specification-Title: updater
Implementation-Vendor-Id: com.updater.service
Class-Path: 
    lib/jsr305-2.0.1.jar 
    lib/spring-boot-starter-1.1.9.RELEASE.jar 
    lib/spring-boot-1.1.9.RELEASE.jar 
    lib/spring-boot-autoconfigure-1.1.9.RELEASE.jar 
    lib/spring-boot-starter-logging-1.1.9.RELEASE.jar  
    lib/spring-core-4.0.8.RELEASE.jar 
    lib/hibernate-entitymanager-4.3.6.Final.jar 
    lib/spring-data-jpa-1.7.0.RELEASE.jar 
    lib/spring-data-commons-1.9.0.RELEASE.jar 
    lib/spring-orm-4.0.7.RELEASE.jar 
    lib/spring-jdbc-4.0.7.RELEASE.jar 
    lib/spring-aop-4.0.7.RELEASE.jar 
    lib/aopalliance-1.0.jar 
    lib/spring-tx-4.0.7.RELEASE.jar 
    lib/spring-beans-4.0.7.RELEASE.jar 
    ...
version: 1
Implementation-Vendor: SoftwareEntwicklung Beratung Schulung
Main-Class: com.updater.config.Application
artifactId: updater
Created-By: Apache Maven 3.2.5
Build-Jdk: 1.8.0_31
Specification-Version: 1