2

I am using Ubuntu 14.04 and Tomcat7.

For some reason, I needed to upgrade java-7 to java-8. So I installed openjdk-8 and set it default using update-alternatives --config java command. To my surprise, tomcat was still using java7.

To resolve the issue, I modified the /usr/share/tomcat7/bin/setenv.sh file and added following line.

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/

Now tomcat7 is using java-8 but because of above modification in setenv.sh file, I am not able to stop tomcat server using service tomcat7 stop. It shows the [OK] message but tomcat process is still running.

Any suggestions ?

EDIT-1 : I have also noticed that service tomcat7 start is starting the tomcat server but printing below text on console.

* Starting Tomcat servlet engine tomcat7 [fail]

EDIT-2 : I had set JAVA_HOME(which points to Java8) in setenv.sh then service is not working but when I removed JAVA_HOME from setenv.sh and put it in catalina.sh then everything is working as expected.

9
  • You should have restarted the tomcat instance after changing the default Java machine. If you install from DEB packages, you should not need to include a JAVA_HOME in your setenv.sh at all. Your option now it to kill -15 the process. Also, I recall there was an update-java-alternatives as well.
    – dawud
    Dec 7, 2016 at 12:26
  • I have restarted tomcat after that modification by killing tomcat process. Everytime I need to deploy something in tomcat, I have to kill the process then start the service.
    – Bhushan
    Dec 7, 2016 at 13:28
  • Maybe you could find the process for tomcat ps -ef|grep -i tomcat and kill the process. kill -9 id Dec 12, 2016 at 7:20
  • You had better check catalina.out Dec 12, 2016 at 7:22
  • @Walter-MSFT Sorry for misunderstanding, I don't want to stop the server by killing the process but I want to stop it using service tomcat7 stop.
    – Bhushan
    Dec 12, 2016 at 8:53

1 Answer 1

0

when service tomcat7 status tells that tomcat do not run properly, search in journalctl xe what is going on. If you cannot repair it yourself, there should be any log published here, to help other people repair the same problem and to repair it quickly. Without any logs you can repair it in week, two. with logs and right, detailed answer it can be day or two.

You have sure you installed properly your java? Your java version?

Tomcat 7.0 is designed to run on Java SE 6 and later.

In addition, Tomcat 7.0 uses the Eclipse JDT Java compiler for compiling JSP pages. This means you no longer need to have the complete Java Development Kit (JDK) to run Tomcat, but a Java Runtime Environment (JRE) is sufficient. The Eclipse JDT Java compiler is bundled with the binary Tomcat distributions. Tomcat can also be configured to use the compiler from the JDK to compile JSPs, or any other Java compiler supported by Apache Ant.

In web a lot posts tells there was compiling bug tomcat7 with java8 in 2014 and 2015 year. Maybe it is the problem? What we can do without logs?

1
  • There is nothing in catalina.out but there is one strange thing. I had set JAVA_HOME(which points to Java8) in setenv.sh then service is not working but when I removed JAVA_HOME from setenv.sh and put it in catalina.sh then everything is working as expected. Any clue ?
    – Bhushan
    Dec 15, 2016 at 4:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .