I have recently upgraded my development machine to Ubuntu 18.04 and have been revisiting and checking some old projects, one of which is built under Eclipse oxygen and deployed using Tomcat 7.
To the best of my memory this project worked when deploying the .war file to the private instance of tomcat (running on port 10080) and the main, autostarting instance on 8080.
It still works on 10080 but when I deploy to 8080 and open through a browser, I see
javax.servlet.ServletException: java.lang.UnsupportedClassVersionError: org/eclipse/jdt/internal/compiler/env/INameEnvironment : Unsupported major.minor version 52.0
I have $JAVA_HOME
as JAVA_HOME="/usr/lib/jvm/java-8-oracle"
The main tomcat manager page shows :
Apache Tomcat/7.0.68 (Ubuntu) JVM version 1.7.0_80-b15
I have set the the eclipse compiler compliance level to 1.7.
I am completely baffled as to why one instance is OK and the other not. I don't want to change the JAVA_HOME, so I think it must be something to do with the tomcat configuration or the internal compiler but can't seem to sort it out.
All sensible suggestions will be gratefully received.
Edit:
This is not a duplicate of a question, as I have built one war file and exported it to ~/junk. After that I have copied and pasted it to the separate webapps folders for the two Tomcat instances. I think it's a tomact configuration issue but I can't see what. Please don't mark it as duplicate
Edit 2:
Looking at how the tomcat was started as a service with systemctl I see:
nick@nick-X555LAB:~$ systemctl status tomcat7.service
tomcat7.service - LSB: Start Tomcat.
Loaded: loaded (/etc/init.d/tomcat7; generated)
Active: active (running) since Mon 2018-08-20 12:04:29 BST; 55s ago
Docs: man:systemd-sysv-generator(8)
Process: 10050 ExecStart=/etc/init.d/tomcat7 start (code=exited, status=0/SUCC
Tasks: 20 (limit: 4915)
CGroup: /system.slice/tomcat7.service
└─10109 /usr/lib/jvm/java-7-oracle/bin/java -Djava.util.logging.confi
Aug 20 12:04:24 nick-X555LAB systemd[1]: Starting LSB: Start Tomcat....
Aug 20 12:04:24 nick-X555LAB tomcat7[10050]: * Starting Tomcat servlet engine t
Aug 20 12:04:29 nick-X555LAB tomcat7[10050]: ...done.
Aug 20 12:04:29 nick-X555LAB systemd[1]: Started LSB: Start Tomcat..
Note the reference to java7 - I'd like to switch this to java 8
Solved
Solved it. Found a reference to java 7 in /etc/default/tomcat7, changed it to java 8 and all is well.