gpt4 book ai didi

spring - 使用 Tomcat 7 在 Openshift 上部署显示空白页

转载 作者:行者123 更新时间:2023-11-28 23:26:06 26 4
gpt4 key购买 nike

当我插入“git push origin master”命令以启动 Tomcat 时,它显示错误:

remote: [ERROR] Failed to perform 
org.apache.maven.plugins goal: maven-war-plugin: 2.1.1: war (default-war) on
project sissopront: Error assembling WAR: webxml attribute is required (pre-
existing or WEB-INF / web.xml if executing mode in update)

如果我在 pom.xml 中插入插件 maven-war-plugin <failOnMissingWebXml> false </ failOnMissingWebXml>

它正常编译成功,但只显示白页。

注意:我的war这个改名为ROOT.war。我试图放置标签 ` ',但它显示没有找到 web.xml 的错误

最佳答案

maven-war-plugin 的声明应该是这样的

<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>deployments</outputDirectory>
<warName>ROOT</warName>
<!-- Java EE 6 doesn't require web.xml, Maven
needs to catch up! -->
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>

只需在 APP_DIR/src/main/webapp/WEB-INF/web.xml 中创建一个包含内容的基本 web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">

</web-app>

关于spring - 使用 Tomcat 7 在 Openshift 上部署显示空白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36873517/

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