错误4620 --- [restartedMain] o.s.boot.SpringApplication:应用程序运行失败

时间:2020-09-05 05:47:00

标签: java spring-boot

我无法清除此错误。请帮助我。

我的pom文件

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>Fitness1</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>Fitness1</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <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-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            </dependency>
        <dependency>
          <groupId>javax.xml.bind</groupId>
          <artifactId>jaxb-api</artifactId>
          </dependency> 
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

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

</project>

我的pom文件有什么问题

显示为错误

2020-09-05 11:16:21.116错误10684 --- [restartedMain] o.s.boot.SpringApplication:应用程序运行失败 org.springframework.context.ApplicationContextException:无法启动Web服务器;无法启动Web服务器。嵌套异常是java.lang.IllegalArgumentException:为基本目录指定的位置[C:\ Users \ Priyanka \ AppData \ Local \ Temp \ tomcat.6838231680585031970.8085]不是目录 在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161)〜[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] 在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545)〜[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE] 在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)〜[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] 在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] 在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] 在org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] 在org.springframework.boot.SpringApplication.run(SpringApplication.java:315)[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] 在org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] 在org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)上[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] 在com.example.fitness.Fitness1Application.main(Fitness1Application.java:11)​​[classes /:na] 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)〜[na:1.8.0_161] 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[na:1.8.0_161] 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[na:1.8.0_161] 在java.lang.reflect.Method.invoke(Method.java:498)〜[na:1.8.0_161] 在org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)[spring-boot-devtools-2.3.3.RELEASE.jar:2.3.3.RELEASE] 由以下原因引起:java.lang.IllegalArgumentException:为基本目录指定的位置[C:\ Users \ Priyanka \ AppData \ Local \ Temp \ tomcat.6838231680585031970.8085]不是目录 在org.apache.catalina.startup.Tomcat.initBaseDir(Tomcat.java:868)〜[tomcat-embed-core-9.0.37.jar:9.0.37] 在org.apache.catalina.startup.Tomcat.getServer(Tomcat.java:657)〜[tomcat-embed-core-9.0.37.jar:9.0.37] 在org.apache.catalina.startup.Tomcat.getService(Tomcat.java:589)〜[tomcat-embed-core-9.0.37.jar:9.0.37] 在org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:182)〜[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] 在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:178)〜[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] 在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:158)〜[spring-boot-2.3.3.RELEASE.jar:2.3.3.RELEASE] ...省略了14个共同的框架

1 个答案:

答案 0 :(得分:0)

在这里查看这个问题:Tomcat Server creating Directories in tmp

似乎您正在端口8085上运行,并且tomcat尝试使用默认文件夹。

我的建议是为临时文件声明一个新文件夹,并为tomcat用户提供访问权限以在其中进行写入。

我认为在您的PC中创建一个文件夹属于权限问题,与您的pom文件无关。