BeanDefinitionStoreException

BeanDefinitionStoreException

本文介绍了Springboot:BeanDefinitionStoreException:无法解析配置类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过运行用maven创建的jar并低于下面的异常来执行我的springboot应用程序,该异常在经过多次尝试后仍未得到解决.任何帮助或指针都将受到赞赏.

谢谢.

请在下面找到异常跟踪.

 2016-01-28 11:35:42.034  INFO 3732 --- [           main] Application                              : Starting Application on DFWLW72RTG262 with PID 3732 (C:\project\RestSpringBoot\target\springboot-0.0
.1-SNAPSHOT.jar started by vaigupta in C:\project\RestSpringBoot\target)
2016-01-28 11:35:42.123  INFO 3732 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7
d7cd6ad: startup date [Thu Jan 28 11:35:42 CST 2016]; root of context hierarchy
2016-01-28 11:35:42.149  WARN 3732 --- [           main] ionWarningsApplicationContextInitializer :

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.


2016-01-28 11:35:48.607  WARN 3732 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [Application]; nested exception is java.io.FileNotFoundException: class path resource [org/springfra
mework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:177)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
        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:606)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
        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:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at Application.main(Application.java:9)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened b
ecause it does not exist
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
        at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98)
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:591)
        at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:762)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:297)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:163)
        ... 18 common frames omitted

2016-01-28 11:35:48.645  INFO 3732 --- [           main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [jar:file:/C:/project/RestSpringBoot/target/springboot-0
.0.1-SNAPSHOT.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter-web-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.
0.1-SNAPSHOT.jar!/lib/spring-boot-starter-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestS
pringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-autoconfigure-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter-log
ging-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jul-to-slf4j-1.7.7.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.j
ar!/lib/log4j-over-slf4j-1.7.7.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/logback-classic-1.1.2.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0
.0.1-SNAPSHOT.jar!/lib/logback-core-1.1.2.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/snakeyaml-1.14.jar!/, jar:file:/C:/project/RestSpringBoot/target/springbo
ot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter-tomcat-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-embed-core-8.0.15.jar!/, jar:file:/C:/pr
oject/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-embed-el-8.0.15.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-embed-logging-juli-8.0
.15.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-embed-websocket-8.0.15.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/
lib/jackson-databind-2.4.4.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jackson-annotations-2.4.4.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0
.0.1-SNAPSHOT.jar!/lib/jackson-core-2.4.4.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/hibernate-validator-5.1.3.Final.jar!/, jar:file:/C:/project/RestSpringBoo
t/target/springboot-0.0.1-SNAPSHOT.jar!/lib/validation-api-1.1.0.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jboss-logging-3.1.3.GA.jar!/, jar:file:/C:/p
roject/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/classmate-1.0.0.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-core-4.1.3.RELEASE.jar!/, ja
r:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-web-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-aop-4.1
.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/aopalliance-1.0.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spr
ing-beans-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-context-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0
.0.1-SNAPSHOT.jar!/lib/spring-webmvc-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-expression-4.1.3.RELEASE.jar!/, jar:file:/C:/project/Rest
SpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter-data-jpa-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter
-aop-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/aspectjrt-1.8.4.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!
/lib/aspectjweaver-1.8.4.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter-jdbc-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/s
pringboot-0.0.1-SNAPSHOT.jar!/lib/spring-jdbc-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-jdbc-8.0.15.jar!/, jar:file:/C:/project/RestSpri
ngBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-juli-8.0.15.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-tx-4.1.3.RELEASE.jar!/, jar:file:/C:/pro
ject/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/hibernate-entitymanager-4.3.7.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jboss-logging-ann
otations-1.2.0.Beta1.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/hibernate-core-4.3.7.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-
SNAPSHOT.jar!/lib/antlr-2.7.7.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jandex-1.1.0.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1
-SNAPSHOT.jar!/lib/dom4j-1.6.1.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/xml-apis-1.0.b2.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-S
NAPSHOT.jar!/lib/hibernate-commons-annotations-4.0.5.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar!/, jar:file:/C:/pr
oject/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jboss-transaction-api_1.2_spec-1.0.0.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/javassist
-3.18.1-GA.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-orm-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar
!/lib/spring-data-jpa-1.7.1.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-data-commons-1.9.1.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/ta
rget/springboot-0.0.1-SNAPSHOT.jar!/lib/slf4j-api-1.7.7.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jcl-over-slf4j-1.7.7.jar!/, jar:file:/C:/project/RestSpring
Boot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-aspects-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/hsqldb-2.3.2.jar!/]
2016-01-28 11:35:48.669 ERROR 3732 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [Application]; nested exception is java.io.FileNotFoundException: class path resource [org/springfra
mework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:177)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
        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:606)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
        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:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at Application.main(Application.java:9)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened b
ecause it does not exist
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
        at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98)
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:591)
        at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:762)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:297)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:163)
        ... 18 common frames omitted

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [Application]; nested exception is java.io.FileNotFoundException: class path resource [or
g/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:177)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
        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:606)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
        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:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at Application.main(Application.java:9)
        ... 6 more
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened b
ecause it does not exist
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
        at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98)
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:591)
        at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:762)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:297)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:163)
        ... 18 more
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:62)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        ... 1 more
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [Application]; nested exception is java.io.FileNotFoundException: class path resource [or
g/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:177)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
        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:606)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
        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:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at Application.main(Application.java:9)
        ... 6 more
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened b
ecause it does not exist
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
        at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98)
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:591)
        at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:762)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:297)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:163)
        ... 18 more

下面是我的pom.xml文件.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.0.RELEASE</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>springboot</groupId>
    <artifactId>springboot</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>SpringBoot</name>
    <description>Spring Boot Example</description>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
  <plugins>
    <plugin>
      <!-- Build an executable JAR -->
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.4</version>
      <configuration>
        <archive>
          <manifest>
            <addClasspath>true</addClasspath>
            <classpathPrefix>lib/</classpathPrefix>
            <mainClass>Application</mainClass>
        </manifest>
        </archive>
      </configuration>
    </plugin>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>1.3.2.RELEASE</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


  </plugins>
</build>

<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/snapshot</url>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
    </pluginRepository>
</pluginRepositories>
</project>
解决方案

您的代码位于默认软件包中,即您在src/main/java中有.java个文件,顶部没有package语句.日志中有一条警告消息,表明这很可能会引起问题:

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.

您需要将代码移至其自己的程序包中.例如,将.java文件移动到src/main/java/com/example并将package com.example;添加到每个文件的顶部.

I am trying to execute my springboot application by running the jar created with maven and getting below exception which is not getting resolved after so many attempts.Any help or pointers would be appreciated.

Thanks in advance.

Please find below exception trace.

 2016-01-28 11:35:42.034  INFO 3732 --- [           main] Application                              : Starting Application on DFWLW72RTG262 with PID 3732 (C:\project\RestSpringBoot\target\springboot-0.0
.1-SNAPSHOT.jar started by vaigupta in C:\project\RestSpringBoot\target)
2016-01-28 11:35:42.123  INFO 3732 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7
d7cd6ad: startup date [Thu Jan 28 11:35:42 CST 2016]; root of context hierarchy
2016-01-28 11:35:42.149  WARN 3732 --- [           main] ionWarningsApplicationContextInitializer :

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.


2016-01-28 11:35:48.607  WARN 3732 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [Application]; nested exception is java.io.FileNotFoundException: class path resource [org/springfra
mework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:177)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
        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:606)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
        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:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at Application.main(Application.java:9)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened b
ecause it does not exist
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
        at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98)
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:591)
        at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:762)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:297)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:163)
        ... 18 common frames omitted

2016-01-28 11:35:48.645  INFO 3732 --- [           main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [jar:file:/C:/project/RestSpringBoot/target/springboot-0
.0.1-SNAPSHOT.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter-web-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.
0.1-SNAPSHOT.jar!/lib/spring-boot-starter-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestS
pringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-autoconfigure-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter-log
ging-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jul-to-slf4j-1.7.7.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.j
ar!/lib/log4j-over-slf4j-1.7.7.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/logback-classic-1.1.2.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0
.0.1-SNAPSHOT.jar!/lib/logback-core-1.1.2.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/snakeyaml-1.14.jar!/, jar:file:/C:/project/RestSpringBoot/target/springbo
ot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter-tomcat-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-embed-core-8.0.15.jar!/, jar:file:/C:/pr
oject/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-embed-el-8.0.15.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-embed-logging-juli-8.0
.15.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-embed-websocket-8.0.15.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/
lib/jackson-databind-2.4.4.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jackson-annotations-2.4.4.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0
.0.1-SNAPSHOT.jar!/lib/jackson-core-2.4.4.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/hibernate-validator-5.1.3.Final.jar!/, jar:file:/C:/project/RestSpringBoo
t/target/springboot-0.0.1-SNAPSHOT.jar!/lib/validation-api-1.1.0.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jboss-logging-3.1.3.GA.jar!/, jar:file:/C:/p
roject/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/classmate-1.0.0.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-core-4.1.3.RELEASE.jar!/, ja
r:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-web-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-aop-4.1
.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/aopalliance-1.0.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spr
ing-beans-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-context-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0
.0.1-SNAPSHOT.jar!/lib/spring-webmvc-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-expression-4.1.3.RELEASE.jar!/, jar:file:/C:/project/Rest
SpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter-data-jpa-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter
-aop-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/aspectjrt-1.8.4.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!
/lib/aspectjweaver-1.8.4.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-boot-starter-jdbc-1.2.0.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/s
pringboot-0.0.1-SNAPSHOT.jar!/lib/spring-jdbc-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-jdbc-8.0.15.jar!/, jar:file:/C:/project/RestSpri
ngBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/tomcat-juli-8.0.15.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-tx-4.1.3.RELEASE.jar!/, jar:file:/C:/pro
ject/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/hibernate-entitymanager-4.3.7.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jboss-logging-ann
otations-1.2.0.Beta1.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/hibernate-core-4.3.7.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-
SNAPSHOT.jar!/lib/antlr-2.7.7.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jandex-1.1.0.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1
-SNAPSHOT.jar!/lib/dom4j-1.6.1.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/xml-apis-1.0.b2.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-S
NAPSHOT.jar!/lib/hibernate-commons-annotations-4.0.5.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar!/, jar:file:/C:/pr
oject/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jboss-transaction-api_1.2_spec-1.0.0.Final.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/javassist
-3.18.1-GA.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-orm-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar
!/lib/spring-data-jpa-1.7.1.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-data-commons-1.9.1.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/ta
rget/springboot-0.0.1-SNAPSHOT.jar!/lib/slf4j-api-1.7.7.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/jcl-over-slf4j-1.7.7.jar!/, jar:file:/C:/project/RestSpring
Boot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/spring-aspects-4.1.3.RELEASE.jar!/, jar:file:/C:/project/RestSpringBoot/target/springboot-0.0.1-SNAPSHOT.jar!/lib/hsqldb-2.3.2.jar!/]
2016-01-28 11:35:48.669 ERROR 3732 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [Application]; nested exception is java.io.FileNotFoundException: class path resource [org/springfra
mework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:177)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
        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:606)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
        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:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at Application.main(Application.java:9)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened b
ecause it does not exist
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
        at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98)
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:591)
        at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:762)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:297)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:163)
        ... 18 common frames omitted

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [Application]; nested exception is java.io.FileNotFoundException: class path resource [or
g/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:177)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
        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:606)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
        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:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at Application.main(Application.java:9)
        ... 6 more
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened b
ecause it does not exist
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
        at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98)
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:591)
        at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:762)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:297)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:163)
        ... 18 more
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:62)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
        ... 1 more
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [Application]; nested exception is java.io.FileNotFoundException: class path resource [or
g/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:177)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
        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:606)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
        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:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at Application.main(Application.java:9)
        ... 6 more
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened b
ecause it does not exist
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
        at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98)
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:591)
        at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:762)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:297)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:163)
        ... 18 more

below is my pom.xml file.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.0.RELEASE</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>springboot</groupId>
    <artifactId>springboot</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>SpringBoot</name>
    <description>Spring Boot Example</description>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
  <plugins>
    <plugin>
      <!-- Build an executable JAR -->
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.4</version>
      <configuration>
        <archive>
          <manifest>
            <addClasspath>true</addClasspath>
            <classpathPrefix>lib/</classpathPrefix>
            <mainClass>Application</mainClass>
        </manifest>
        </archive>
      </configuration>
    </plugin>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>1.3.2.RELEASE</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


  </plugins>
</build>

<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/snapshot</url>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
    </pluginRepository>
</pluginRepositories>
</project>
解决方案

Your code is in the default package, i.e. you have .java files in src/main/java with no package statement at the top. There's a warning message in the log indicating that this is likely to cause problems:

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.

You need to move your code into a package of its own. For example, move your .java files into src/main/java/com/example and add package com.example; to the top of each file.

这篇关于Springboot:BeanDefinitionStoreException:无法解析配置类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 10:32