gpt4 book ai didi

java - 在 tomcat 9 上部署 Spring Boot Web 应用程序时,出现错误 "Could not retrieve system property ' spring.xml.ignore'"

转载 作者:行者123 更新时间:2023-12-03 23:38:18 24 4
gpt4 key购买 nike

spring-boot 应用程序在集成服务器上运行良好,但是当我尝试在 tomcat9 上部署它时,在 /catalina.out 中出现以下错误

22-Jun-2021 15:05:38.148 INFO [http-nio-8080-exec-6] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Could not retrieve system property 'spring.xml.ignore': java.security.AccessControlException: access denied ("java.util.PropertyPermission" "spring.xml.ignore" "read")
错误:无法检索系统属性“spring.xml.ignore”:java.security.AccessControlException:访问被拒绝(“java.util.PropertyPermission”“spring.xml.ignore”“read”)
这里是环境的版本信息。

JAVA (Version : Open-jdk-16.0.1)

APACHE TOMCAT (Version : 9.x with )


这是我的 Spring 类
package com.testpackage.tomcattest;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

@SpringBootApplication
public class TomcatApiTestRunner extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(TomcatApiTestRunner.class, args);
}

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(TomcatApiTestRunner.class);
}
}
这是 pom.xml
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>tomcattest-api</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
</parent>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<finalName>tomcattest-api</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>
</project>
application.properties
server.contextPath=/tomcattest-api

最佳答案

您要部署到的 Tomcat 9 安装已配置为禁止读取系统属性。您需要询问管理安装的人员来更改其配置。他们可以通过修改 the catalina.policy file 来实现。授予所需的权限。

关于java - 在 tomcat 9 上部署 Spring Boot Web 应用程序时,出现错误 "Could not retrieve system property ' spring.xml.ignore'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68087087/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com