Using Java 11 with webservices.rest

Can I run this cd openmrs-module-webservices.rest && mvn clean install using Java 11 or it only works with Java 8. Any one to kindly help because everything seems to be failing

@jwnasambu @ibacher @dkayiwa @jnsereko @jonathan @wodpachua @suubi7

2 Likes

At runtime, it works with Java 11, but in development, you need to use Java 8.

3 Likes

Nope it only works with JDK 7 or 8. Reference to this [ERROR] Source option 6 is no longer supported. Use 7 or later

2 Likes

I suppose you are referring to a minimum version to be Java 7 or 8 . But one can run up to version 15. Basing on this notes https://openmrs.atlassian.net/wiki/spaces/RES/pages/26276936/Release+Notes+2.13.0 and development is limited as @ibacher has stated above.

1 Like

ohhh okay @jwnasambu. never worked with another JDK except 8 for me.

1 Like

i also also want to know more about this

Sure! OpenMRS Reference Application has 44 modules as reflected in this document. To run these modules, or a specific module, you need specific versions of Java, Maven, MySQL, and Tomcat. In this case, we were discussing the Java version required to run the Web Services REST module successfully.

2 Likes

I wanted to use it for development, so that means I’ll stick to Jdk 8

I changed to Java-8 but whenever I run mvn clean install I get into errors even before making any changes. Here are the errors

edisonmeks@edisonmeks-Latitude-E6430:~/OpenMRS/openmrs-module-webservices.rest$ mvn clean install [INFO] Scanning for projects… [WARNING] [WARNING] Some problems were encountered while building the effective model for org.openmrs.module:webservices.rest-omod-2.0:jar:2.45.0-SNAPSHOT [WARNING] ‘build.plugins.plugin.version’ for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 160, column 21 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] Rest Web Services [pom] [INFO] Rest Web Services Common OMOD [jar] [INFO] Rest Web Services 1.8 OMOD [jar] [INFO] Rest Web Services 1.9 OMOD [jar] [INFO] Rest Web Services 1.10 OMOD [jar] [INFO] Rest Web Services 1.11 OMOD [jar] [INFO] Rest Web Services 1.12 OMOD [jar] [INFO] Rest Web Services 2.0 OMOD [jar] [INFO] Rest Web Services 2.1 OMOD [jar] [INFO] Rest Web Services 2.2 OMOD [jar] [INFO] Rest Web Services 2.3 OMOD [jar] [INFO] Rest Web Services 2.4 OMOD [jar] [INFO] Rest Web Services OMOD [jar] [INFO] Rest Web Services Integration Tests [jar] [INFO] [INFO] ----------------< org.openmrs.module:webservices.rest >----------------- [INFO] Building Rest Web Services 2.45.0-SNAPSHOT [1/14] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] — maven-clean-plugin:2.5:clean (default-clean) @ webservices.rest — [INFO] [INFO] — maven-java-formatter-plugin:0.4:format (default) @ webservices.rest — [INFO] Using ‘UTF-8’ encoding to format source files. [INFO] Number of files to be formatted: 0 [INFO] [INFO] — license-maven-plugin:3.0:format (format-license-header) @ webservices.rest — [INFO] Updating license headers… [INFO] [INFO] — maven-install-plugin:2.4:install (default-install) @ webservices.rest — [INFO] Installing /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/pom.xml to /home/edisonmeks/.m2/repository/org/openmrs/module/webservices.rest/2.45.0-SNAPSHOT/webservices.rest-2.45.0-SNAPSHOT.pom [INFO] [INFO] ----------< org.openmrs.module:webservices.rest-omod-common >----------- [INFO] Building Rest Web Services Common OMOD 2.45.0-SNAPSHOT [2/14] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] — maven-clean-plugin:2.5:clean (default-clean) @ webservices.rest-omod-common — [INFO] Deleting /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target [INFO] [INFO] — jacoco-maven-plugin:0.7.7.201606060606:prepare-agent (prepare-agent) @ webservices.rest-omod-common — [INFO] argLine set to -javaagent:/home/edisonmeks/.m2/repository/org/jacoco/org.jacoco.agent/0.7.7.201606060606/org.jacoco.agent-0.7.7.201606060606-runtime.jar=destfile=/home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/jacoco.exec,includes=org/openmrs/** [INFO] [INFO] — maven-java-formatter-plugin:0.4:format (default) @ webservices.rest-omod-common — [INFO] Using ‘UTF-8’ encoding to format source files. [INFO] Number of files to be formatted: 160 [INFO] Successfully formatted: 0 file(s) [INFO] Fail to format : 0 file(s) [INFO] Skipped : 160 file(s) [INFO] Approximate time taken: 1s [INFO] [INFO] — license-maven-plugin:3.0:format (format-license-header) @ webservices.rest-omod-common — [INFO] Updating license headers… [INFO] [INFO] — maven-resources-plugin:2.6:resources (default-resources) @ webservices.rest-omod-common — [INFO] Using ‘UTF-8’ encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] skip non existing resourceDirectory /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/main/webapp [INFO] skip non existing resourceDirectory /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/main/webapp [INFO] [INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ webservices.rest-omod-common — [INFO] Changes detected - recompiling the module! [INFO] Compiling 125 source files to /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/classes [WARNING] /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/main/java/org/openmrs/module/webservices/rest/InitPathMatcher.java: Some input files use or override a deprecated API. [WARNING] /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/main/java/org/openmrs/module/webservices/rest/InitPathMatcher.java: Recompile with -Xlint:deprecation for details. [WARNING] /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/DynamicBeanConfiguration.java: Some input files use unchecked or unsafe operations. [WARNING] /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/DynamicBeanConfiguration.java: Recompile with -Xlint:unchecked for details. [INFO] [INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ webservices.rest-omod-common — [INFO] Using ‘UTF-8’ encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/test/resources [INFO] skip non existing resourceDirectory /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/test/resources [INFO] [INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ webservices.rest-omod-common — [INFO] Changes detected - recompiling the module! [INFO] Compiling 35 source files to /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/test-classes [WARNING] /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/test/java/org/openmrs/module/webservices/rest/test/Util.java: /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/test/java/org/openmrs/module/webservices/rest/test/Util.java uses or overrides a deprecated API. [WARNING] /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/test/java/org/openmrs/module/webservices/rest/test/Util.java: Recompile with -Xlint:deprecation for details. [WARNING] /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/test/java/org/openmrs/module/webservices/rest/web/ConversionUtilTest.java: Some input files use unchecked or unsafe operations. [WARNING] /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/src/test/java/org/openmrs/module/webservices/rest/web/ConversionUtilTest.java: Recompile with -Xlint:unchecked for details. [INFO] [INFO] — maven-surefire-plugin:2.22.1:test (default-test) @ webservices.rest-omod-common — [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/surefire-reports/2024-07-23T21-06-11_982-jvmRun1.dumpstream [INFO] [INFO] Results: [INFO] [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for Rest Web Services 2.45.0-SNAPSHOT: [INFO] [INFO] Rest Web Services … SUCCESS [ 2.480 s] [INFO] Rest Web Services Common OMOD … FAILURE [ 12.760 s] [INFO] Rest Web Services 1.8 OMOD … SKIPPED [INFO] Rest Web Services 1.9 OMOD … SKIPPED [INFO] Rest Web Services 1.10 OMOD … SKIPPED [INFO] Rest Web Services 1.11 OMOD … SKIPPED [INFO] Rest Web Services 1.12 OMOD … SKIPPED [INFO] Rest Web Services 2.0 OMOD … SKIPPED [INFO] Rest Web Services 2.1 OMOD … SKIPPED [INFO] Rest Web Services 2.2 OMOD … SKIPPED [INFO] Rest Web Services 2.3 OMOD … SKIPPED [INFO] Rest Web Services 2.4 OMOD … SKIPPED [INFO] Rest Web Services OMOD … SKIPPED [INFO] Rest Web Services Integration Tests … SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 16.324 s [INFO] Finished at: 2024-07-23T21:06:13+03:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project webservices.rest-omod-common: There are test failures. [ERROR] [ERROR] Please refer to /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/surefire-reports for the individual test results. [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. [ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called? [ERROR] Command was /bin/sh -c cd /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common && /usr/lib/jvm/java-11-openjdk-amd64/bin/java ‘-javaagent:/home/edisonmeks/.m2/repository/org/jacoco/org.jacoco.agent/0.7.7.201606060606/org.jacoco.agent-0.7.7.201606060606-runtime.jar=destfile=/home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/jacoco.exec,includes=org/openmrs/’ -Djdk.net.URLClassPath.disableClassPathURLCheck=true -jar /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/surefire/surefirebooter2999705390776777842.jar /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/surefire 2024-07-23T21-06-11_982-jvmRun1 surefire3095480497127845249tmp surefire_010100577893840401120tmp [ERROR] Error occurred in starting fork, check output in log [ERROR] Process Exit Code: 134 [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called? [ERROR] Command was /bin/sh -c cd /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common && /usr/lib/jvm/java-11-openjdk-amd64/bin/java '-javaagent:/home/edisonmeks/.m2/repository/org/jacoco/org.jacoco.agent/0.7.7.201606060606/org.jacoco.agent-0.7.7.201606060606-runtime.jar=destfile=/home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/jacoco.exec,includes=org/openmrs/’ -Djdk.net.URLClassPath.disableClassPathURLCheck=true -jar /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/surefire/surefirebooter2999705390776777842.jar /home/edisonmeks/OpenMRS/openmrs-module-webservices.rest/omod-common/target/surefire 2024-07-23T21-06-11_982-jvmRun1 surefire3095480497127845249tmp surefire_010100577893840401120tmp [ERROR] Error occurred in starting fork, check output in log [ERROR] Process Exit Code: 134 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:669) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1183) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857) [ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148) [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) [ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56) [ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) [ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) [ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) [ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) [ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957) [ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289) [ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:193) [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282) [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225) [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406) [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347) [ERROR] [ERROR] → [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] MojoExecutionException - Apache Maven - Apache Software Foundation [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn -rf :webservices.rest-omod-common

You can also see here

Could anyone be knowing what this could be or anyone has ever gotten the same error @jwnasambu @suubi7 @ibacher @dkayiwa @jnsereko

@edison sorry for the error! Kindly always use pastebin to share error logs. Besides,

  • Ensure the Java version you are using is compatible with the version of the Maven Surefire plugin. The error log mentions you are running Java 11 but Java 8 is required.

  • You might need to adjust the memory settings for the JVM used by Maven. Kindly, configure the MAVEN_OPTS environment variable to increase the heap size: export MAVEN_OPTS="-Xms512m -Xmx1024m"

1 Like

It seems there’s something which is not right because I changed java to java-8 maybe I have to set it in the project itself. Is there any provision for that

@edison yes you might hhave changed to jdk 8. But your JAVA_HOME path may be still pointing to java 11. Did you adjust the JAVA_HOME path to point to JDK 8?

sure, the JAVA_HOME variable also changed but it still comes

could you share the logs on pastebin again @edison