2 u013935114 u013935114 于 2018.02.06 10:51 提问

spring boot start error
2018-02-06 09:59:24.084 |-INFO  [restartedMain] tv.seei.manage.ManageApplication [48] -| Starting ManageApplication on USER-PC with PID 6588 (E:\ideaWorkspace\manage\target\classes started by Administrator in E:\ideaWorkspace\SpringBootSample01)
2018-02-06 09:59:24.087 |-INFO  [restartedMain] tv.seei.manage.ManageApplication [597] -| The following profiles are active: dev
2018-02-06 09:59:24.276 |-INFO  [background-preinit] org.hibernate.validator.internal.util.Version [30] -| HV000001: Hibernate Validator 5.3.6.Final
2018-02-06 09:59:25.267 |-INFO  [restartedMain] org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext [583] -| Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@c74731: startup date [Tue Feb 06 09:59:25 CST 2018]; root of context hierarchy
2018-02-06 09:59:28.826 |-INFO  [restartedMain] org.springframework.data.repository.config.RepositoryConfigurationDelegate [165] -| Multiple Spring Data modules found, entering strict repository configuration mode!
2018-02-06 09:59:28.976 |-INFO  [restartedMain] org.springframework.data.repository.config.RepositoryConfigurationDelegate [165] -| Multiple Spring Data modules found, entering strict repository configuration mode!
2018-02-06 09:59:29.085 |-INFO  [restartedMain] org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport [270] -| Spring Data Redis - Could not safely identify store assignment for repository candidate interface tv.seei.manage.authorization.dao.UserDao.
2018-02-06 09:59:31.695 |-WARN  [restartedMain] org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext [551] -| Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.NullPointerException
2018-02-06 09:59:31.714 |-INFO  [restartedMain] org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer [101] -| 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-02-06 09:59:31.745 |-ERROR [restartedMain] org.springframework.boot.SpringApplication [771] -| Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.NullPointerException
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at tv.seei.manage.ManageApplication.main(ManageApplication.java:12)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.NullPointerException: null
    at org.springframework.boot.autoconfigure.web.ServerProperties$Tomcat$1.customize(ServerProperties.java:878)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.configureContext(TomcatEmbeddedServletContainerFactory.java:498)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.prepareContext(TomcatEmbeddedServletContainerFactory.java:234)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:178)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)
    ... 13 common frames omitted

6个回答

sd1209286540
sd1209286540   2018.02.06 11:17
已采纳

把enableautoconfiguration注解去掉再启动

sd1209286540
sd1209286540 回复永无止境I: 因为spring-boot-autoconfigure这个是自动装配的依赖,但是springboot里面自己封装了,再依赖可能会报错
16 天之前 回复
u013935114
u013935114 多谢,困扰我两天的问题解决了
16 天之前 回复
u013935114
u013935114 回复sd1209286540: 好了,在pom.xml 去掉 spring boot autoconfigure 就行了,这是为什么,之前这样都好好的,为什么今天就不行了
16 天之前 回复
sd1209286540
sd1209286540 回复永无止境I: 还有可能是因为你加了spring-boot-autoconfigure这个的原因,这个应该是不用加到依赖里面去的
16 天之前 回复
sd1209286540
sd1209286540 回复永无止境I: <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.0http://maven.apache.org/xsd/maven-4.0.0.xsd">把这个替换掉你的,而且那个springbootApplication注解含有enableautoconfiguration注解的功能
16 天之前 回复
u013935114
u013935114 贴到下边了
16 天之前 回复
sd1209286540
sd1209286540 回复永无止境I: springboot启动是不需要这个注解的,你把pom里面的依赖以及application.propertiesw文件贴出来看看
16 天之前 回复
u013935114
u013935114 百度看到一篇帖子说加上这个,加上了还是不行,去掉也是一样的错
16 天之前 回复
fst018666
fst018666   2018.02.06 10:59

at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.NullPointerException: null
at tv.seei.manage.ManageApplication.main(ManageApplication.java:12)
主要看这2个地方,有空指针

u013935114
u013935114 ManageApplication是启动类,看不出来 什么,也不知道是哪错了
16 天之前 回复
qq_35702591
qq_35702591   2018.02.06 11:02

空指针错误,请查看你的 spring配置文件是否在web。xml里配置了,是否成功加载

u013935114
u013935114 这是spring boot 没有web.xml配置文件的
16 天之前 回复
qq_35702591
qq_35702591 回复永无止境I: 你跟踪一下,如果注解注入的那个对象直接为null,那么需要在spring配置文件中 加入包扫描配置,<context:component-scan base-package=‘’>
16 天之前 回复
u013935114
u013935114 回复qq_35702591: 好像没有,不知道 怎么解决,
16 天之前 回复
qq_35702591
qq_35702591 回复永无止境I: ManageApplication 开头的那个springBootApplication 注解,注入成功了吗,你的注解是否能够扫描的你这个java文件?
16 天之前 回复
u013935114
u013935114 spring boot 就是不知道 哪错了
16 天之前 回复
u013935114
u013935114   2018.02.06 10:59

这是ManageApplication 启动类

 @SpringBootApplication
@EnableAutoConfiguration
public class ManageApplication {

    public static void main(String[] args) {
        SpringApplication.run(ManageApplication.class, args);
    }
}
sd1209286540
sd1209286540 把enableautoconfiguration注解去掉再启动
16 天之前 回复
u013935114
u013935114   2018.02.06 11:24

pox.xml 配置文件

<?xml version="1.0" encoding="UTF-8"?>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0

<groupId>tv.seei</groupId>
<artifactId>manage</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>manage</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>

    <!--redis-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
    </dependency>

    <!-- mongodb -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>

    <!--thymeleaf  -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure</artifactId>
        <version>RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>

    <!--swagger 接口文档生成-->
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.7.0</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.7.0</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <fork>true</fork>
            </configuration>
        </plugin>
    </plugins>
</build>


qq_15396517
qq_15396517   2018.02.06 11:30

注解只要加@SpringBootApplication就够了
pom.xml可能写错了
建议用工具生成或者去自动生成spring boot demo 网站里按需要生成就不会有错了
其次是可能maven下载的包由于网络或者种种原因有问题(我学习的时候第一次就出现这种情况,另一台电脑就好好的)
把项目先关了再maven仓库删除了打开项目重新更新下maven就可以解决

u013935114
u013935114 之前都是好好的,有几天没启动了,昨天启动报错,不想删maven本地库,下maven依赖好慢,
16 天之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!