1

I am new to Openshift and having trouble with deploying my Java EE project to it. I have made REST API for a simple webstore. Locally it works fine on Wildfly 9.0.2 I want to deploy it on openshift. I 've made new wildfly9 + mysql5.5 application using eclipse openshit jboss plugin and added a profile to root pom.xml:

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

My root project consist of several maven modules including store-ear (EAR), store-jpa (JAR), store-rest (WAR), store-web (WAR), store-services (EJB), store-rest-interfaces (JAR),store-service-interfaces (JAR). I have changed datasourse in JPA configuration (persistence.xml) to use MysqlDB on Openshift. After pushing back to openshift the build is succesfull, but when it gets deployed it is missing some dependancies (ClassNotFoundException), and fails to deploy main war file.

Rémi Bantos
  • 1,899
  • 14
  • 27
janerz6
  • 13
  • 3
  • Sounds like you have runtime dependencies that have managed to make it into your local maven repository but have not been referenced properly in your build (pom.xml file?) Without knowing more it's hard to suggest more. – K.Nicholas Feb 04 '16 at 19:35

1 Answers1

0

You use a maven-war plugin in your openshift maven profile. But you say that your project is packaged as en ear. So you should probably deploy this ear which contains all your project modules (wars, ejbs, libs...) instead of a specific war of your project.

To achieve this, you have to use a maven-ear plugin instead of the maven-war one in your openshift profile which would look like this:

<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>
Rémi Bantos
  • 1,899
  • 14
  • 27