Getting error on BrokerController.class - compiled with different version of java
jjosserand opened this issue · 11 comments
What is the proper way to recompile this class so it can be used with my version of java?
Caused by: java.lang.UnsupportedClassVersionError: com/esri/geoportal/harvester/rest/BrokerController has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 (unable to load class [com.esri.geoportal.harvester.rest.BrokerController])
do you know what Java version you are using. as the message suggest it looks like your tomcat is using an older version than what the harvester was compiled with
Jesse,
In the top level pom.xml do the following:
- Replace values of maven.compiler.source and maven.compiler.target from '11' to '1.8'
- Comment out the section in pom.xml marked as ' Dependencies required for JAVA 11/13 runtime environment' (three dependencies obsolete in 1.8)
then recompile the entire code with JDK 1.8 with: 'mvn clean install'.
Let us know if that has solved your issues.
the Geoportal Server source code is available here in this repository. You can clone it or download into a local zip. Then expand and run the maven command from the top-level folder.
Ok. Thanks. I can download the zip, of course. I understand that. However, I've been away from this level of coding for some time doing management, sysadmin, and database work. Would you mind giving me the exact commands I need to run after I've uploaded the code to the affected server(s)?
Jesse,
You need the following:
- Java JDK (I presume you may already have one). Important! Having just Java JRE (runtime) is not enough; JDK is required. We use AdoptOpenJDK for our daily work available at: https://adoptopenjdk.net/, You can test if you have JDK installed by invoking
javac --version
(notice its javac not java? javac is a compiler), - Make sure you have JAVA_HOME environment variable pointing to the 'root' folder where your JDK is installed,
- You need Apache Maven build tool available at https://maven.apache.org/,
- It's a good idea to put 'bin' folders from your JDK and Maven on your PATH environment variable,
Then invoke build from within Harvester root folder:
mvn clean install
First time you do it it will take time because build has to download all the required dependencies. Once it's done the 'war' file will be placed inside 'target' folder within Harvester root folder.
you've got mail!
Where have I got mail? (ha ha).