这是我的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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.shubham</groupId>
<artifactId>HelloWorld_SpringBoot1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
这是我的RestController
package com.shubham.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@RequestMapping(value="/")
public String hello(){
return "Hello World !";
}
}
这是我的java资源
package com.shubham.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HelloWorldSpringBootApp {
public static void main(String[] args) {
SpringApplication.run(HelloWorldSpringBootApp.class, args);
}
}
运行HelloWorldSpringBootApp应用程序时。我的控制台抛出一个错误,即启动ApplicationContext时出错。要显示自动配置报告,请在启用“debug”的情况下重新运行应用程序。 2018-04-19 22:56:10.594 ERROR 8708 --- [main] o.s.boot.SpringApplication:应用程序启动失败
2018-04-19 22:56:06.641 INFO 8708 --- [ main]
com.shubham.app.HelloWorldSpringBootApp : Starting HelloWorldSpringBootApp
on DESKTOP-O51GA6O with PID 8708 (started by Shubham Yadav in E:\Spring
Project\HelloWorld_SpringBoot1)
2018-04-19 22:56:06.706 INFO 8708 --- [ main]
com.shubham.app.HelloWorldSpringBootApp : No active profile set, falling
back to default profiles: default
2018-04-19 22:56:06.950 INFO 8708 --- [ main]
ationConfigEmbeddedWebApplicationContext : Refreshing
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicatio
nContext@4f51b3e0: startup date [Thu Apr 19 22:56:06 IST 2018]; root of context
hierarchy
2018-04-19 22:56:09.828 WARN 8708 --- [ main]
ationConfigEmbeddedWebApplicationContext : Exception encountered during
context initialization - cancelling refresh attempt:
org.springframework.context.ApplicationContextException: Unable to start
embedded container; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'tomcatEmbeddedServletContainerFactory' defined in class
path resource
[org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigu ration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception
is org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name
'org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration':
Unsatisfied dependency expressed through constructor parameter 0; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'spring.http.encoding-
org.springframework.boot.autoconfigure.web.HttpEncodingProperties':
Initialization of bean failed; nested exception is
java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver
2018-04-19 22:56:10.502 INFO 8708 --- [ main]
utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report
re-run your application with 'debug' enabled.
2018-04-19 22:56:10.594 ERROR 8708 --- [ main]
o.s.boot.SpringApplication : Application startup failed
org.springframework.context.ApplicationContextException: Unable to start
embedded container; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'tomcatEmbeddedServletContainerFactory' defined in class path
resource[org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigu
ration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception
is org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name
'org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration':
Unsatisfied dependency expressed through constructor parameter 0; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'spring.http.encoding-
org.springframework.boot.autoconfigure.web.HttpEncodingProperties':
Initialization of bean failed; nested exception is
java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefre sh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-
1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.refresh(Abstract
ApplicationContext.java:537) ~[spring-context-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh
(EmbeddedWebApplicationContext.java:122) ~[spring-boot-
1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.jav
a:360) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
com.shubham.app.HelloWorldSpringBootApp.main(HelloWorldSpringBootApp.java:10)
[classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in
class path resource
[org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigu
ration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception
is org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name
'org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration':
Unsatisfied dependency expressed through constructor parameter 0; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'spring.http.encoding-
org.springframework.boot.autoconfigure.web.HttpEncodingProperties':
Initialization of bean failed; nested exception is
java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.do
CreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.cr
eateBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Abstr
actBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingl
eton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abstrac
tBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractB
eanFactory.java:202) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbe
ddedServletContainerFactory(EmbeddedWebApplicationContext.java:199) ~[spring-
boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createE
mbeddedServletContainer(EmbeddedWebApplicationContext.java:162) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefre
sh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-
1.5.9.RELEASE.jar:1.5.9.RELEASE]
... 8 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name
'org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration':
Unsatisfied dependency expressed through constructor parameter 0; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'spring.http.encoding-
org.springframework.boot.autoconfigure.web.HttpEncodingProperties':
Initialization of bean failed; nested exception is
java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArr
ay(ConstructorResolver.java:749) ~[spring-beans-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstruct
or(ConstructorResolver.java:189) ~[spring-beans-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.au
towireConstructor(AbstractAutowireCapableBeanFactory.java:1193) ~[spring-beans-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.cr
eateBeanInstance(AbstractAutowireCapableBeanFactory.java:1095) ~[spring-beans-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.do
CreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.cr
eateBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Abstr
actBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingl
eton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-
4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:519) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.getCustomizers(EmbeddedServletContainerCustomizerBeanPostProcessor.java:82) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:72) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:59) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
... 16 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
... 41 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver
at org.hibernate.validator.internal.util.TypeResolutionHelper.<init>(TypeResolutionHelper.java:21) ~[hibernate-validator-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:124) ~[hibernate-validator-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:104) ~[hibernate-validator-5.3.6.Final.jar:5.3.6.Final]
at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:33) ~[hibernate-validator-5.3.6.Final.jar:5.3.6.Final]
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:276) ~[validation-api-1.1.0.Final.jar:na]
at org.springframework.boot.validation.MessageInterpolatorFactory.getObject(MessageInterpolatorFactory.java:53) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor$ValidatedLocalValidatorFactoryBean.<init>(ConfigurationPropertiesBindingPostProcessor.java:412) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.getValidator(ConfigurationPropertiesBindingPostProcessor.java:369) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.determineValidator(ConfigurationPropertiesBindingPostProcessor.java:353) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:315) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:292) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
... 51 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.fasterxml.classmate.TypeResolver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_144]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_144]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_144]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_144]
... 65 common frames omitted
请帮帮我!