2014-09-18 1 views
0

스프링 부트가 처음이고 스프링 부트 1.1.6을 사용하는 응용 프로그램을 빌드 중입니다. 기본 응용 프로그램은 정상적으로 작동했습니다. .<< "Spring boot 1.1.6"스레드 "main"의 예외 org.springframework.beans.factory.BeanDefinitionStoreException

하지만 일부 종속성을 추가하면 응용 프로그램을 시작하고 쳐다볼 때 아래 예외가 표시되지 않습니다.

내 build.gradle 파일

` buildscript { 
    ext { 

     springBootVersion = '1.1.6.RELEASE' 
    } 
    repositories { 
     maven { 
     url "http://repo.spring.io/libs-snapshot" 
     } 
     mavenLocal() 
    } 
    dependencies { 
     classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.6.RELEASE") 
    } 
} 

apply plugin: 'java' 
apply plugin: 'eclipse' 
apply plugin: 'idea' 
apply plugin: 'spring-boot' 
apply plugin: 'war' 

sourceCompatibility = 1.7 

compileJava { 
    targetCompatibility = 1.7 
} 

war { 
    baseName = 'gs-convert-jar-to-war' 
    version = '0.1.0' 
} 

repositories { 
    mavenCentral() 
    mavenLocal() 
    maven { url "http://repo.spring.io/libs-snapshot" } 
    maven { url "http://maven.springframework.org/milestone" } 
} 

dependencies { 

    compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") { 
     exclude module: "spring-boot-starter-tomcat" 
     exclude module:"spring-boot-starter-logging" 
    } 
    providedRuntime("org.springframework.boot:spring-boot-starter-jetty:${springBootVersion}") 

    compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}") 
    compile("org.springframework.boot:spring-boot-starter-aop:${springBootVersion}") 
    compile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}") 
    compile("org.springframework.boot:spring-boot-starter-security:${springBootVersion}") 

    compile("com.google.guava:guava:17.0") 
    compile("com.squareup.retrofit:retrofit:1.6.0") 
    compile("commons-io:commons-io:2.4") 
    compile("com.local.abdd:abdd-jith912:1.0.4-SNAPSHOT"){ 
    exclude module:"slf4j-api" 
    } 
    compile("com.local.abdd:abdd-jith912:1.0.4-SNAPSHOT:tests"){ 
    exclude module:"slf4j-api" 
    } 
    testCompile("junit:junit") 
    compile("org.slf4j:slf4j-api:1.7.7"){ 
    force = true 
    } 
    compile("org.slf4j:slf4j-log4j12:1.7.7"){ 
    force=true 
    } 
    compile("org.slf4j:slf4j-jdk14:1.7.7"){ 
    force=true 
    } 
} 

task wrapper(type: Wrapper) { 
    gradleVersion = '1.11' 
} 
` 
 

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Failed to load bean class: ; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist 
    at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:392) 
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:165) 
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:305) 
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) 
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) 
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) 
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:611) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109) 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:952) 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:941) 
    at org.magnum.mobilecloud.video.Application.main(Application.java:27) 
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist 
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) 
    at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:50) 
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:82) 
    at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) 
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:77) 
    at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:561) 
    at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:736) 
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:284) 
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:218) 
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:435) 
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:258) 
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:218) 
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:435) 
    at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:389) 
    ... 13 more 
 

내 Gradle을 종속 출력은 내가 여기에 입력 할 수없는 너무 크다. 나는

| +--- com.local.infra.thirdparty:oracle-simplefan:11.2.0.2 
| |   | | | | +--- javax.jms:jms:1.1 
| |   | | | | +--- org.springframework:spring-jms:3.1.1.RELEASE 
| |   | | | | | +--- aopalliance:aopalliance:1.0 
| |   | | | | | +--- org.springframework:spring-aop:3.1.1.RELEASE -> 4.0.7.RELEASE (*) 
| |   | | | | | +--- org.springframework:spring-beans:3.1.1.RELEASE -> 4.0.7.RELEASE (*) 
| |   | | | | | +--- org.springframework:spring-context:3.1.1.RELEASE -> 4.0.7.RELEASE (*) 
| |   | | | | | +--- org.springframework:spring-core:3.1.1.RELEASE -> 4.0.7.RELEASE (*) 
| |   | | | | | \--- org.springframework:spring-tx:3.1.1.RELEASE -> 3.2.2.RELEASE 
| |   | | | | |   +--- aopalliance:aopalliance:1.0 
| |   | | | | |   +--- org.springframework:spring-beans:3.2.2.RELEASE -> 4.0.7.RELEASE (*) 
| |   | | | | |   \--- org.springframework:spring-core:3.2.2.RELEASE -> 4.0.7.RELEASE (*) 

+--- org.springframework.security:spring-security-core:3.0.4.RELEASE -> 3.2.5.RELEASE (*) 
| | | | |   | | +--- org.springframework.security:spring-security-taglibs:3.0.4.RELEASE 
| | | | |   | | | +--- org.springframework.security:spring-security-web:3.0.4.RELEASE -> 3.2.5.RELEASE (*) 
| | | | |   | | | +--- org.springframework.security:spring-security-acl:3.0.4.RELEASE 
| | | | |   | | | | +--- org.springframework.security:spring-security-core:3.0.4.RELEASE -> 3.2.5.RELEASE (*) 
| | | | |   | | | | \--- org.springframework:spring-context-support:3.0.3.RELEASE -> 3.2.2.RELEASE (*) 
| | | | |   | | | \--- org.springframework:spring-web:3.0.3.RELEASE -> 4.0.7.RELEASE (*) 
| | | | |   | | +--- org.springframework.security:spring-security-config:3.0.4.RELEASE -> 3.2.5.RELEASE (*) 
+0

Yuo haven ' 모든 의존성을 추가했다. 파트를 추가 할 때 또는 l에서 Spring 부트 스타터 프로젝트를 사용하는 것이 강력히 권장된다. 동쪽은 스프링 의존성 제공 버전을 사용합니다. POM을 추가하십시오. –

+0

안녕하세요 Deinum, 도와 주셔서 감사합니다. https://github.com/spring-guides/gs-spring-boot/blob/master/initial/build.gradle에서 build.gradle 파일을 사용하여 추가 항목을 참조하고 있습니다. 내 로컬 저장소에. – jith912

+0

파일을 주석으로 추가하거나 초기 질문을 편집하거나 연장하지 마십시오. –

답변

2

나는이 문제를 해결할 것이라고 100 % 확신하지 않는다, 그러나 그것은 올바른 방향으로 물건을 이동합니다 같은 이적 종속성으로 사용되는 일부 봄 구성 요소를 찾을 수 그러나 .

동일한 Spring 프로젝트의 다른 종속성과 동기화되지 않은 여러 종속성이 있습니다. 예를 들어 Spring Framework 의존성에 버전이 혼합되어 있습니다. 대부분 4.0.7.RELEASE이지만 일부는 3.x.x입니다. .이 문제를 해결하는

한 가지 방법은 문제가있는 모듈을 명시 적으로 직접 종속성을 추가하는 것입니다 (봄 부팅 예를 들어 당신을 위해 올바른 버전을 제공합니다 :

dependencies { 
    compile 'org.springframework:spring-context-support' 
    compile 'org.springframework:spring-jms' 
    compile 'org.springframework:spring-tx' 
    compile 'org.springframework:spring-security-acl' 
    compile 'org.springframework:spring-security-taglibs' 
} 

이 변경을하고보고하십시오 gradle dependencies 다시 한번 동일한 Spring 프로젝트에서 다른 모듈과 다른 버전의 모듈을 찾은 경우이 과정을 반복하십시오. 버전이 모두 올바르게 보이면 다시 실행 해보십시오.

+0

Gr8! 종속성을 명시 적으로 지정하면 마법이 생겼습니다. Andy Wilkinson과 Deinum 감사합니다. – jith912

관련 문제