springboot 启动报错 java.lang.IllegalStateException: Failed to introspect annotated methods on class org
1 . ____ _ __ _ _ 2 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ 3 ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 4 \\/ ___)| |_)| | | | | || (_| | ) ) ) ) 5 ' |____| .__|_| |_|_| |_\__, | / / / / 6 =========|_|==============|___/=/_/_/_/ 7 :: Spring Boot :: (v1.4.1.RELEASE) 8 9 [ INFO ] [2017-11-03 14:50:17:017] com.taikang.Application [48] [main]- Starting Application on WMM with PID 4384 (started by Administrator in G:\workspace-s\IdeaProjects\hello) 10 [ INFO ] [2017-11-03 14:50:17:017] com.taikang.Application [665] [main]- The following profiles are active: DEV 11 [ INFO ] [2017-11-03 14:50:17:017] org.hibernate.validator.internal.util.Version [30] [background-preinit]- HV000001: Hibernate Validator 5.2.4.Final 12 [ INFO ] [2017-11-03 14:50:18:018] org.springframework.context.annotation.AnnotationConfigApplicationContext [581] [main]- Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@bdd8f7: startup date [Fri Nov 03 14:50:18 CST 2017]; root of context hierarchy 13 [ WARN ] [2017-11-03 14:50:18:018] org.springframework.context.annotation.AnnotationConfigApplicationContext [549] [main]- Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.taikang.Application]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.support.SpringBootServletInitializer 14 Disconnected from the target VM, address: '127.0.0.1:60450', transport: 'socket' 15 [ ERROR] [2017-11-03 14:50:18:018] org.springframework.boot.SpringApplication [839] [main]- Application startup failed 16 org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.taikang.Application]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.support.SpringBootServletInitializer 17 at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:187) 18 at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:324) 19 at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:246) 20 at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) 21 at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) 22 at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681) 23 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523) 24 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) 25 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) 26 at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) 27 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) 28 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) 29 at com.taikang.Application.main(Application.java:36) 30 Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.support.SpringBootServletInitializer 31 at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:163) 32 at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:301) 33 at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:237) 34 at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:204) 35 at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:173) 36 ... 12 common frames omitted 37 Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext 38 at java.lang.Class.getDeclaredMethods0(Native Method) 39 at java.lang.Class.privateGetDeclaredMethods(Class.java:2615) 40 at java.lang.Class.getDeclaredMethods(Class.java:1860) 41 at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:152) 42 ... 16 common frames omitted 43 Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext 44 at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 45 at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 46 at java.security.AccessController.doPrivileged(Native Method) 47 at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 48 at java.lang.ClassLoader.loadClass(ClassLoader.java:425) 49 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 50 at java.lang.ClassLoader.loadClass(ClassLoader.java:358) 51 ... 20 common frames omitted 52 53 Process finished with exit code 1
解决方法:
pom.xml中的
hello world!!!
<scope>provided</scope>
to<scope>compile</scope>
and it worked!!.