在openshift中运行项目后空白页面打开

问题描述:

我在openshift中部署了一个Web应用程序。尽管构建和部署是成功的,我上单击应用程序得到一个空白页:在openshift中运行项目后空白页面打开

http://adoreindia-adoreindia.a3c1.starter-us-west-1.openshiftapps.com/

下面是pom.xml中。

<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> 
    <groupId>org.adore.india.actions</groupId> 
    <artifactId>Adore_india_project</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <dependencies> 
    <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>javax.servlet-api</artifactId> 
     <version>3.1.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.ow2.asm</groupId> 
     <artifactId>asm</artifactId> 
     <version>5.1</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-fileupload</groupId> 
     <artifactId>commons-fileupload</artifactId> 
     <version>1.3.3</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.commons</groupId> 
     <artifactId>commons-lang3</artifactId> 
     <version>3.6</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-logging</groupId> 
     <artifactId>commons-logging</artifactId> 
     <version>1.1.3</version> 
    </dependency> 
    <dependency> 
     <groupId>org.freemarker</groupId> 
     <artifactId>freemarker</artifactId> 
     <version>2.3.23</version> 
    </dependency> 
    <dependency> 
     <groupId>org.javassist</groupId> 
     <artifactId>javassist</artifactId> 
     <version>3.20.0-GA</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.logging.log4j</groupId> 
     <artifactId>log4j-api</artifactId> 
     <version>2.8.2</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.logging.log4j</groupId> 
     <artifactId>log4j-core</artifactId> 
     <version>2.3</version> 
    </dependency> 
    <dependency> 
     <groupId>ognl</groupId> 
     <artifactId>ognl</artifactId> 
     <version>3.1.12</version> 
    </dependency> 
    <dependency> 
     <groupId>com.jgeppert.struts2.bootstrap</groupId> 
     <artifactId>struts2-bootstrap-plugin</artifactId> 
     <version>2.5.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.struts</groupId> 
     <artifactId>struts2-convention-plugin</artifactId> 
     <version>2.5.12</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.struts</groupId> 
     <artifactId>struts2-core</artifactId> 
     <version>2.5.12</version> 
    </dependency> 
    </dependencies> 
    <build> 
    <sourceDirectory>src</sourceDirectory> 
    <resources> 
     <resource> 
     <directory>src</directory> 
     <excludes> 
      <exclude>**/*.java</exclude> 
     </excludes> 
     </resource> 
    </resources> 
    <plugins> 
     <plugin> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.5.1</version> 
     <configuration> 
      <source>1.8</source> 
      <target>1.8</target> 
     </configuration> 
     </plugin> 
     <plugin> 
     <artifactId>maven-war-plugin</artifactId> 
     <version>3.0.0</version> 
     <configuration> 
      <warSourceDirectory>WebContent</warSourceDirectory> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
    <profiles> 
     <profile> 
      <id>openshift</id> 
      <build> 
       <finalName>Adore_india_project</finalName> 
       <plugins> 
        <plugin> 
         <artifactId>maven-war-plugin</artifactId> 
         <version>3.0.0</version> 
         <configuration> 
          <outputDirectory>webapps</outputDirectory> 
          <warName>ROOT</warName> 
         </configuration> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> 
</project> 

该应用程序在本地系统中运行良好。请建议我如何解决这个问题。

删除配置文件标记并更正上下文根,工件标识为您的上下文根名称已解决该问题。

应用程序URL -

http://adoreindia-project-adore-india-project.a3c1.starter-us-west-1.openshiftapps.com/your-context-root-name-0.0.1-SNAPSHOT/

下面是修改后的pom.xml。

<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> 
    <groupId>org.adore.india.actions</groupId> 
    <artifactId>adore-india-project</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <dependencies> 
    <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>javax.servlet-api</artifactId> 
     <version>3.1.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.ow2.asm</groupId> 
     <artifactId>asm</artifactId> 
     <version>5.1</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-fileupload</groupId> 
     <artifactId>commons-fileupload</artifactId> 
     <version>1.3.3</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.commons</groupId> 
     <artifactId>commons-lang3</artifactId> 
     <version>3.6</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-logging</groupId> 
     <artifactId>commons-logging</artifactId> 
     <version>1.1.3</version> 
    </dependency> 
    <dependency> 
     <groupId>org.freemarker</groupId> 
     <artifactId>freemarker</artifactId> 
     <version>2.3.23</version> 
    </dependency> 
    <dependency> 
     <groupId>org.javassist</groupId> 
     <artifactId>javassist</artifactId> 
     <version>3.20.0-GA</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.logging.log4j</groupId> 
     <artifactId>log4j-api</artifactId> 
     <version>2.8.2</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.logging.log4j</groupId> 
     <artifactId>log4j-core</artifactId> 
     <version>2.3</version> 
    </dependency> 
    <dependency> 
     <groupId>ognl</groupId> 
     <artifactId>ognl</artifactId> 
     <version>3.1.12</version> 
    </dependency> 
    <dependency> 
     <groupId>com.jgeppert.struts2.bootstrap</groupId> 
     <artifactId>struts2-bootstrap-plugin</artifactId> 
     <version>2.5.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.struts</groupId> 
     <artifactId>struts2-convention-plugin</artifactId> 
     <version>2.5.12</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.struts</groupId> 
     <artifactId>struts2-core</artifactId> 
     <version>2.5.12</version> 
    </dependency> 
    </dependencies> 
    <build> 
    <sourceDirectory>src</sourceDirectory> 
    <resources> 
     <resource> 
     <directory>src</directory> 
     <excludes> 
      <exclude>**/*.java</exclude> 
     </excludes> 
     </resource> 
    </resources> 
    <plugins> 
     <plugin> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.5.1</version> 
     <configuration> 
      <source>1.8</source> 
      <target>1.8</target> 
     </configuration> 
     </plugin> 
     <plugin> 
     <artifactId>maven-war-plugin</artifactId> 
     <version>3.0.0</version> 
     <configuration> 
      <warSourceDirectory>WebContent</warSourceDirectory> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
    <!-- <profiles> 
     <profile> 
      <id>openshift</id> 
      <build> 
       <finalName>Adore_india_project</finalName> 
       <plugins> 
        <plugin> 
         <artifactId>maven-war-plugin</artifactId> 
         <version>3.0.0</version> 
         <configuration> 
          <outputDirectory>webapps</outputDirectory> 
          <warName>ROOT</warName> 
         </configuration> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> --> 
</project> 

在构建日志看的.war文件的名称:

[INFO]建筑战争:/tmp/src/target/yourcontextrootname-0.0.1-SNAPSHOT.war

“yourcontextrootname “是应用程序的上下文根 - 您应该看到您的上下文根名称。 (How to change context root of a dynamic web project in Eclipse?

为了能够访问我的OpenShift3启动应用程序,我有过这样

...网址后,我的.war文件的名称追加adoreindia-adoreindia.a3c1.starter美-west-1.openshiftapps.com/yourcontextrootname-0.0.1-SNAPSHOT

+0

生成日志显示战争文件的名称 - [INFO]建筑战争:/tmp/src/webapps/ROOT.war 我已经修改了Web应用程序根目录的上下文根。这不起作用,仍然显示空白页面。我在事件中发现了两条警告 - 1.无法为pod“adoreindia-3-deploy_adore-india(3805e0d4-99cf-11e7-a546-06579ed29230)”装入卷:超时等待卷挂接/挂载pod“adore-india”/“adoreindia-3-deploy”。未连接/未挂载的卷列表= [部署者令牌-ngq25] 2.同步错误pod – Arnab

+0

我无法对这些警告说些什么。从来没有像这样的。这就是我的web应用程序的工作原理: 构建由每次推送时git存储库中的webhook触发。 在我的pom.xml中,我没有部分。可能有区别,这就是为什么你的.war文件被命名为ROOT。我认为上下文根本应该是以前的样子,我提供的链接仅用于澄清,其中可以找到上下文根的名称。 除了这些信息我只能说,我必须在OpenShift3中重新创建Web应用程序多次,从头开始,才能正常运行。 – nikoalset