Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-14193

(7.1.z) RPM - Setting JAVA_HOME not effective in RHEL-6 init scripts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.1.1.CR2, 7.1.1.GA
    • 7.1.0.GA
    • RPM, Scripts
    • None
    • Hide

      Manually edit (as root) the file /etc/rc.d/init.d/eap7-standalone and fix the setting of PATH as in the description above.

      Show
      Manually edit (as root) the file /etc/rc.d/init.d/eap7-standalone and fix the setting of PATH as in the description above.
    • Hide

      Install the EAP 7.1.0 RPMs on a RHEL-6 machine.

      Make sure both Java 6 (or Java7) and Java 8 are installed and the alternatives do NOT point to Java 8 (in some systems the default MUST be different from Java 8 because of other software that cannot run with Java 8)

      Try and start the eap7-standalone service.

      Show
      Install the EAP 7.1.0 RPMs on a RHEL-6 machine. Make sure both Java 6 (or Java7) and Java 8 are installed and the alternatives do NOT point to Java 8 (in some systems the default MUST be different from Java 8 because of other software that cannot run with Java 8) Try and start the eap7-standalone service.
    • EAP 7.1.1

    Description

      The file /etc/sysconfig/eap7-standalone provides a way to set the JAVA_HOME.

      For instance, it was set to

      # Uncomment the following for location of java in the SDK
      JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64
      

      However, the server still fails to start:

      # service eap7-standalone start
      Starting eap7-standalone:                                  [FAILED]
      Please ensure alternatives is set to use Java specification version 1.8 or later.
      

      This is caused by this line in the init script itself /etc/rc.d/init.d/eap7-standalone

      if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
        export PATH=$PATH:$JAVAPTH
      fi
      

      Usually PATH already has 'java' which in this machine was from a Java 6, and the service fals to start.

      These lines should be:

      if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
        export PATH=$JAVAPTH:$PATH
      fi
      

      So the intended settings override whatever was there previously.

      With this change the server starts normally:

      # service eap7-standalone start
      Starting eap7-standalone:                                  [  OK  ]
      

      Note: JAVAPTH is set from JAVA_HOME some lines above:

      #make sure java is on your path
      JAVAPTH=${JAVAPTH:-"$JAVA_HOME/bin"}
      

      Attachments

        Activity

          People

            permaine Permaine Cheung
            fnasser Fernando Nasser
            Daniel Cihak Daniel Cihak
            Daniel Cihak Daniel Cihak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: