Alan,

On 7/9/25 1:04 PM, Alan Masters wrote:
I have successfully developed a WAR file with Eclipse  Version: 2024-06 (4.32.0) which has JRE System Library Java SE-17   and tested using Tomcat 9.0.91 as a local host on Windows 11.

I had started work on this around a year ago and do not recall setting up CATALINA_HOME or JAVA_HOME, but assume I must have done this somehow.

I have now been trying so set up a test system on another laptop (Windows 10) with Tomcat 9.0.106 so that I can pass it to someone else for testing.

I dropped the same WAR file used on my successful test system on this other laptop and got

    07-Jul-2025 17:09:06.094 SEVERE [http-nio-8080-exec-7]
    org.apache.catalina.core.StandardWrapperValve.invoke Allocate
    exception for servlet [amcon.mps_methods.Login
    *Java.lang.UnsupportedClassVersionError: amcon/mps_methods/Login has
    been compiled by a more recent version of the Java Runtime (class
    file version 61.0), this version of the Java Runtime only recognizes
    class file versions up to 52.0 (unable to load class
    [amcon.mps_methods.Login])*

*On the Windows 10 test system I checked the Java Version*

    *Java -version java version "1.8.0_451" Java(TM) SE Runtime
    Environment (build 1.8.0_451-b10)*

You have correctly identified the source of the problem: your application was compiled with Java 17 without any backward-compatibility flags, so you get "class version 61". It was nice of Sun to de-couple the class-file version from the Java version so now you get to keep track of two version-type things. :(

*Then I downloaded Java 17 SDK and set a Windows environment variable JAVA_HOME C:\Program Files\Java\jdk-17*

*I also set **a Windows environment variable CATALINA_HOME appropriately.*

I think that won't affect anything, but it depends upon how you launch Tomcat. How are you launching Tomcat? Specifically, is this a Windows Service-style things, or are you launching from the command-line?

*Tomcat then refused to run the JSP used to launch the Login Servlet (at least with the 1.8 JRE I was able to execute the login JSP, but not the Login servlet)*

    **


      *HTTP Status 404 – Not Found*

    *

------------------------------------------------------------------------

    TypeStatus Report

    MessageJSP file [/MPSv3/Login.jsp] not found

    DescriptionThe origin server did not find a current representation
    for the target resource or is not willing to disclose that one exists.

------------------------------------------------------------------------


          Apache Tomcat/9.0.106


    *
    Please could someone advise how I can correct my configuration on
    the *Windows 10 test system *

Try the following:

1. Stop Tomcat
2. Delete the work\ directory
3. Start Tomcat
4. Check to see if your JSP loads properly

If that works, you are back where you started, trying to get Java 17 running instead of Java 8.

If you are using Tomcat started as a Windows Service, you will need to run tomcat9w.exe to edit the service, and set a different path for the Java version you have now installed. MY guess is that it's using either specifically that Java 8 version, or just "the system version" -- whatever that means. It's better to specify exactly where your Java is that you want to run.

Hope that helps,
-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to