Hardik Vadodariya
Hardik Vadodariya

Reputation: 135

Openshift update java 7 to 8 in Tomcat 7 (JBoss EWS 2.0) Cartridge

I am new to Openshift and i have created a server instance using Tomcat 7 (JBoss EWS 2.0) cartridge for my spring boot web application.

Initially, web application was using JDK7 and was working fine on Openshift. Now for some enhancement we have to switch to JDK8.

I tried searching on Google about changing JAVA_HOME to JDK8 and i tried most of the solutions but i can not make it work.

The above solutions don't work. Other option is DIY cartridge which may work but i don't want to create new application and move everything there.

EDIT

Below is the directory structure

Directory Structure

Please note that i have created this application using open shift UI and not using rhc command.

Please guide me.

Thanks

Upvotes: 5

Views: 1335

Answers (2)

Piotr Kuciapski
Piotr Kuciapski

Reputation: 106

I had to "cheat" a little to enable java 8, since the "java8" marker doesn't seem to work. Look at the JbossEWS cartridge source:

function export_java_home() {
  if marker_present "java7"; then
    export JAVA_HOME=$OPENSHIFT_JBOSSEWS_JDK7
  else
    export JAVA_HOME=$OPENSHIFT_JBOSSEWS_JDK6
  fi
}

So, my solution/workaround is:

  • Set your OPENSHIFT_JBOSSEWS_JDK7 environment var to point to jdk8 instead of jdk7:
rhc env set OPENSHIFT_JBOSSEWS_JDK7="/etc/alternatives/java_sdk_1.8.0" -a YOURAPPNAME
  • Add the java7 marker to your .openshift/markers directory.

Upvotes: 3

K.Nicholas
K.Nicholas

Reputation: 11551

Sounds like bad planning: You're supposed to that your platform supports Java-8 before writing code that requires it. From the Openshift documentation:

3.2. Java Environments Supported By JBoss Enterprise Application Platform 6 JBoss Enterprise Application Platform 6 requires Java 6 or Java 7. The list of supported Java environments can be found at http://www.jboss.com/products/platforms/application/supportedconfigurations/. A Java Development Kit (JDK) is required for development, and a Java Runtime Environment (JRE) is required to run JBoss Enterprise Application Platform.

Upvotes: 0

Related Questions