Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在openshift.com上部署Spring MVC项目_Java_Spring Mvc_Openshift - Fatal编程技术网

Java 如何在openshift.com上部署Spring MVC项目

Java 如何在openshift.com上部署Spring MVC项目,java,spring-mvc,openshift,Java,Spring Mvc,Openshift,我想部署一个简单的Spring MVC应用程序来打开shift,我在谷歌上搜索了一下,发现项目结构不同,我有基本的Spring MVC项目结构是 也就是说,我在openshift.com上创建了应用程序,并将其配置为: 但是,当我转到我的应用程序url时,我无法将my home.jsp文件视为欢迎文件。我只看到默认/传统的欢迎页面。有任何建议如何配置项目以正确工作吗?首先,您克隆了git存储库,然后在document文件夹中自动创建了文件夹 然后将war文件解压缩并通过克隆目录进入webapp

我想部署一个简单的Spring MVC应用程序来打开shift,我在谷歌上搜索了一下,发现项目结构不同,我有基本的Spring MVC项目结构是


也就是说,我在openshift.com上创建了应用程序,并将其配置为:


但是,当我转到我的应用程序url时,我无法将my home.jsp文件视为欢迎文件。我只看到默认/传统的欢迎页面。
有任何建议如何配置项目以正确工作吗?

首先,您克隆了git存储库,然后在document文件夹中自动创建了文件夹

然后将war文件解压缩并通过克隆目录进入webapps文件夹

并创建测试文件夹,将代码粘贴到文件夹和根war文件中

然后在文件夹名称中写入ulr并输入

比如说

像这样

git clone ssh://5565c850e0b8cd07580001ba@yourdomain.rhcloud.com
将提取的war文件粘贴到克隆目录中

然后发射git命令

$ git add .
$ git commit -m "A checkin to my application"
$ git push

您的pom.xml存在一个主要问题,我认为这使得您的应用程序无法在openshift.com上运行。您应该在pom.xml中添加以下行

<profiles>
    <profile>
        <!-- When built in OpenShift the 'openshift' profile will be used when 
            invoking mvn. -->
        <!-- Use this profile for any OpenShift specific customization your app 
            will need. -->
        <!-- By default that is to put the resulting archive into the 'webapps' 
            folder. -->
        <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
        <id>openshift</id>
        <build>
            <finalName>yourAppName</finalName>
            <plugins>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1.1</version>
                    <configuration>
                        <outputDirectory>webapps</outputDirectory>
                        <warName>ROOT</warName>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

openshift
你的应用程序名
maven战争插件
2.1.1
网络应用
根

我还没有用JBoss应用服务器测试过这段代码,所以把你的服务器改成ApacheTomcat7。这对我来说是正确的。

我已经从github推送了repo如何获得该工作?您已经推送了repo,然后部署成功,您的应用程序消息在终端中。然后在浏览器中打开。很抱歉,我没有得到您想要说的内容,但我的本地计算机上没有任何repo副本,我已经从github.com推送了它!您已经给出了github的源代码,但是openshift不需要给出github源代码。他们已经在openshift中内置了git。请查看我的编辑并思考一下!如何处理这一个?我已经厌倦了这种方式,但我仍然无法让我的应用程序正常工作。请你为我做这件事,我会把你作为我的项目的贡献者。加上我,我们将在那里做更多的步骤。