2016-02-04 169 views
1

我是Openshift的新手,並且無法將我的Java EE項目部署到它。我爲一個簡單的webstore製作了REST API。本地它在Wildfly 9.0.2上正常工作我想在openshift上部署它。我已經使用eclipse openshit JBoss的插件,取得了新的wildfly9 + mysql5.5應用程序,並增加了配置文件根的pom.xml:將Java EE Wildfly REST應用程序部署到Openshift

<profiles> <profile> <id>openshift</id> <build> <finalName>webstore</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.3</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> <outputDirectory>deployments</outputDirectory> </configuration>
</plugin> </plugins> </build> </profile> </profiles>

我的根項目包含幾個行家模塊,包括商店耳(EAR) ,store-jpa(JAR),store-rest(WAR),store-web(WAR),store-services(EJB),store-rest-interfaces(JAR),store-service-interfaces(JAR)。 我已經改變JPA配置(persistence.xml)中的datasourse在Openshift上使用MysqlDB。 推回到openshift構建成功,但是當它被部署時它缺少一些依賴(ClassNotFoundException),並且無法部署主要的war文件。

+0

聽起來像是你有運行時依賴關係已經成功地將它放到你的本地maven倉庫中,但是在你的構建中沒有被正確引用(pom.xml文件?)。不知道更多,很難提出更多的建議。 –

回答

0

你在你的openshift maven-profile中使用了一個maven-war插件。 但是你說你的項目打包成en ear。所以你應該部署這個包含你所有項目模塊(戰爭,ejbs,libs)的耳朵,而不是你的項目的特定戰爭。

要做到這一點,你必須使用一個行家耳插件代替Maven的戰爭一個在你openshift輪廓這將是這樣的:

<profile> 
<id>openshift</id> 
<build> 
    <plugins> 
     <plugin> 
      <artifactId>maven-ear-plugin</artifactId> 
      <version>2.10</version> 
      <configuration> 
      <outputDirectory>deployments</outputDirectory> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
</profile> 
+0

這解決了我的問題。 – janerz6