0

I am running a Centos7 system for Tomcat. Everything was working properly using Tomcat 8.5 and OpenJDK but the dev wants to use Oracle JDK. So, I yum autoremove the JDK files and then downloaded the RPMs from Oracle for JDK-9.0.1 and JRE-9.0.1. Right now, I can't seem to get Tomcat working again.

● tomcat.service - Apache Tomcat Web Application Container
Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-10-18 11:33:07 PDT; 10s ago
Process: 6525 ExecStop=/bin/kill -15 $MAINPID (code=exited, status=1/FAILURE)
Process: 6513 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=0/SUCCESS)
Main PID: 1055 (code=exited, status=143)

Oct 18 11:33:07 tomcat_base1 systemd[1]: Starting Apache Tomcat Web Application Container...
Oct 18 11:33:07 tomcat_base1 startup.sh[6513]: Existing PID file found during start.
Oct 18 11:33:07 tomcat_base1 startup.sh[6513]: Removing/clearing stale PID file.
Oct 18 11:33:07 tomcat_base1 systemd[1]: tomcat.service: control process exited, code=exited status=1
Oct 18 11:33:07 tomcat_base1 systemd[1]: Failed to start Apache Tomcat Web Application Container.
Oct 18 11:33:07 tomcat_base1 systemd[1]: Unit tomcat.service entered failed state.
Oct 18 11:33:07 tomcat_base1 systemd[1]: tomcat.service failed.

It looks like the new Java installed properly:

java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
saleetzo
  • 570
  • 2
  • 9
  • 23

1 Answers1

2

I'd suggest you a robust way of binding Tomcat to specific version of JDK. Under tomcat_location_dir/bin subdir you can find setenv.sh file. Modify it by adding line:

JAVA_HOME=/path/to/desired/jdk_home

Then (re)start tomcat service. This will only affect this instance of tomcat. BTW that's the recommended way of setup specific tomcat environment.

Important: make sure you have JDK version not just JRE if in doubt doubt, just download the suitable tar/zip from http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html then unpack it to /path/to/desired/jdk_home mentioned above

Tagwint
  • 2,410
  • 1
  • 13
  • 22
  • Also, if you setup Alternatives, you can tell the OS where to find particular programs, like `java`, `javac`, `javaws`, `jar`. I have attched a link for details https://unix.stackexchange.com/questions/282313/how-to-verify-if-java-is-installed-on-rhel/282315#282315 – thebtm Oct 18 '17 at 19:50