2017-09-09 87 views
0

我在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> 

該應用程序在本地系統中運行良好。請建議我如何解決這個問題。

回答

0

刪除配置文件標記並更正上下文根,工件標識爲您的上下文根名稱已解決該問題。

應用程序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> 
0

在構建日誌看的.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

相關問題