【问题标题】:App don`t start from index.jsp as it declared in web.xml <welcome-file-list> after deploy on GCloud应用程序不要从 index.jsp 开始,因为它在 GCloud 上部署后在 web.xml <welcome-file-list> 中声明
【发布时间】:2020-06-15 12:01:45
【问题描述】:

您遇到的问题:
- 将应用程序部署到 gcloud 上的 appengine 后,gradle 默认网页为 index.html。但是在 web.xml 中声明:
<welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list>

在本地环境中,它按照我的预期和声明从 index.jsp 开始,但部署后不是

您预期会发生什么:
- 应用程序从 index.jsp 页面开始。正如它声明的那样

我使用 Gradle https://github.com/GoogleCloudPlatform/app-gradle-plugin 部署到 appEngine

【问题讨论】:

    标签: google-app-engine


    【解决方案1】:

    在将其添加到web.xml 文件后,我遵循了这一点:

    <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
            http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
            version="3.1">
    
        <welcome-file-list>  
            <welcome-file>index.jsp</welcome-file>  
        </welcome-file-list>  
    </web-app>
    

    即使有 index.html 文件,我的应用也以 index.jsp 文件开始。

    我还与您分享我的build.gradle 文件的App Engine 部分:

    appengine {  // App Engine tasks configuration
        deploy {   // deploy configuration
            projectId = System.getenv('GOOGLE_CLOUD_PROJECT')
            version = 'GCLOUD_CONFIG'
        }
    }
    

    【讨论】:

    • 我的 web.xml&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javae`e/web-app_3_1.xsd" version="3.1"&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt; &lt;/welcome-file-list&gt;
    • 我的文件是一样的,有什么问题吗?如何检查 WAR 文件中是否正确指定了起始页配置?
    • 您可以使用Cloud Debugger。此外,您可以部署到新版本而不是相同的版本名称
    猜你喜欢
    • 2017-08-19
    • 1970-01-01
    • 2016-11-28
    • 2015-11-27
    • 2017-04-20
    • 1970-01-01
    • 2018-02-23
    • 2012-11-07
    相关资源
    最近更新 更多