问题
I want to deploy my web application in a real TOMCAT 6 server which uses other applications. The problem is, when I put my WAR-file in webbApps, I get an error in the log file and I get an error 404:
java.lang.UnsupportedClassVersionError: metier/utilisateurs/Compte : Unsupported major.minor version 51.0 (unable to load class metier.utilisateurs. Compte) at org.apache.catalina.loader. WebappClassLoader.findClassInternal( WebappClassLoader.java:2822)...
I googled this and I found that there is no compatible JDK and compiler of JSP.
My question is: Can I deploy my application in a different tomcat (7) server and use 2 tomcat in the same server? I tried this but when I start my new tomcat (tomcat7/bin/startup), the server starts the old tomcat automatically!
回答1:
You compiled your war using Java 7 and you are trying to run it inside a Tomcat 6 with Java 6. Configure your Tomcat 6 to point to the java 7 installation and it should work there as well.
Also, it is possible to have two Tomcats running on the same machine, but on different ports. If you do this, you should use a load balancer or a proxy in front to distribute the requests. However, using two different versions of the container on the same machine to run the same application is a bit unusual.
Regarding the fact that starting one Tomcat actually starts up the other one, it is probably due to the fact that you haven't configured it's CATALINA_HOME and it simply checks the usual locations for Tomcat and finds the other one.
See: https://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt - Advanced Configuration - Multiple Tomcat Instances
来源:https://stackoverflow.com/questions/32197386/deployment-of-my-application-in-existing-tomcat