Manual installation build tests fail at openmrs-api

Application Name: Replace this text with one of: Platform, Reference Application Version Number: O3

Question: I attempted to follow the instructions for a Manual Installation here: Get Set Up · GitBook

I have installed the JDK:

javac -version
> javac 20.0.1

I have also installed MySQL and logged in as root.

After running mvn clean install from the openmrs-core directory, I get the following output:

[ERROR] Tests run: 4494, Failures: 59, Errors: 1117, Skipped: 55
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for OpenMRS 2.7.0-SNAPSHOT:
[INFO] 
[INFO] OpenMRS ............................................ SUCCESS [  0.498 s]
[INFO] openmrs-tools ...................................... SUCCESS [  0.297 s]
[INFO] openmrs-test ....................................... SUCCESS [  0.062 s]
[INFO] openmrs-api ........................................ FAILURE [03:37 min]
[INFO] openmrs-web ........................................ SKIPPED
[INFO] openmrs-webapp ..................................... SKIPPED
[INFO] openmrs-liquibase .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:38 min
[INFO] Finished at: 2023-07-12T11:47:57-04:00
[INFO] ------------------------------------------------------------------------

There are many errors, but most seem to include: module java.base does not "opens java.lang" to unnamed module @17c1bced

NOTE: I also tried setting up the SDK prior to this, but ran into a different issue:

After running mvn openmrs-sdk:setup

Setting up a new server...

Specify server id (-DserverId) (default: 'server'): server

You can setup the following servers:
1) 2.x Distribution
2) Platform
3) 03 Distribution

Which one do you choose? [1/2/3]: 3

You can deploy the following versions of O3:
1) Reference Application 3.0.0-SNAPSHOT
2) Other...

Unable to find/resolve artifact. The following artifacts could not be resolved: org.openmrs.module:initializer-omod:jar:2.5.0 (absent): org.openmrs.module:initializer-omod:jar:2.5.0 was not found in https://mavenrepo.openmrs.org/public

Any help with getting setup with either approach (so that I can begin frontend development) would be appreciated!

You’ll need to install Java 8 or 11. Java 8 is probably more convenient for using OpenMRS.

To fix the issue with the SDK you need to add the Mekom Repository to your - Maven settings.xml. Follow this: O3 Implementer Documentation: Set Up, Configure & Deploy - Projects - OpenMRS Wiki

1 Like

@wikumc Haven’t we fixed that in newer versions of the SDK? I’m publishing those now…

I think users have to manually add the repository.

cc: @dkayiwa

It should be possible to just add it to the settings.xml file here; that will be deployed whenever someone runs the setup-sdk command.

I created a PR for this: Adding Mekom Repository by wikumChamith · Pull Request #241 · openmrs/openmrs-sdk · GitHub

I thought I did; I manually created a settings.xml file at ~/.m2/settings.xml with just the Mekom repository within an otherwise empty profile. During setup, my file ended up like this (see below). Nesting the repository within the active profile allowed me to continue with setup. Thanks!

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <mirrors>
    <mirror>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>http://0.0.0.0/</url>
      <blocked>true</blocked>
      <id>maven-default-http-blocker</id>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <id>mks-nexus-public</id>
          <name>Mekom Repository</name>
          <url>https://nexus.mekomsolutions.net/repository/maven-public</url>
        </repository>
      </repositories>
    </profile>
    <profile>
      <repositories>
        <repository>
          <id>openmrs-repo</id>
          <name>OpenMRS Repository</name>
          <url>https://mavenrepo.openmrs.org/public</url>
        </repository>
        <repository>
          <releases>
            <checksumPolicy>fail</checksumPolicy>
          </releases>
          <snapshots>
            <checksumPolicy>warn</checksumPolicy>
          </snapshots>
          <id>archetype</id>
          <url>https://mavenrepo.openmrs.org/public</url>
        </repository>
        <repository>
          <id>openmrs-repo-thirdparty</id>
          <name>OpenMRS Thirdparty Nexus Repository</name>
          <url>https://mavenrepo.openmrs.org/thirdparty</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>openmrs-repo</id>
          <name>OpenMRS Nexus Repository</name>
          <url>https://mavenrepo.openmrs.org/public</url>
        </pluginRepository>
      </pluginRepositories>
      <id>openmrs</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>openmrs</activeProfile>
  </activeProfiles>
  <pluginGroups>
    <pluginGroup>org.openmrs.maven.plugins</pluginGroup>
  </pluginGroups>
</settings>
1 Like

I will give this a shot, thank you.

UPDATE:

After completing OpenMRS SDK setup, I ran mvn openmrs-sdk:run -DserverId=server and got the following error:

Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:5.1.0:run (default-cli) on project openmrs: Failed running Tomcat

I read that Tomcat is a requirement for manual installations of the backend, but is it also required for the SDK? Is Java 8 a requirement for both the SDK and manual installations?

@ibacher @wikumc

Could you provide the full output? That error isn’t terribly helpful.

The SDK comes with a version of Tomcat.

1 Like

Here is additional output (skipping some INFO and WARNING outputs):

Checking if port 8000 is in use... [free]
Unrecognized VM option 'MaxPermSize=512m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for OpenMRS 2.7.0-SNAPSHOT:
[INFO] 
[INFO] OpenMRS ............................................ FAILURE [  0.726 s]
[INFO] openmrs-tools ...................................... SKIPPED
[INFO] openmrs-test ....................................... SKIPPED
[INFO] openmrs-api ........................................ SKIPPED
[INFO] openmrs-web ........................................ SKIPPED
[INFO] openmrs-webapp ..................................... SKIPPED
[INFO] openmrs-liquibase .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.052 s
[INFO] Finished at: 2023-07-12T14:56:52-04:00
[INFO] ------------------------------------------------------------------------

Here is the stack trace:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:5.1.0:run (default-cli) on project openmrs: Failed running Tomcat
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed running Tomcat
    at org.openmrs.maven.plugins.Run.runInFork (Run.java:230)
    at org.openmrs.maven.plugins.Run.executeTask (Run.java:112)
    at org.openmrs.maven.plugins.AbstractTask.execute (AbstractTask.java:201)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)

@wikumc Would you be able to make another quick PR? Over in Run.java, we set a couple of memory-related parameters that actually haven’t been relevant since Java 8. They’re silently ignored on Java 8 and seem to be causing the above error. I think the code there can just be removed, but maybe we do need to do a check of the JDK version?

sorry for the delay here is the PR: Removing maven opts by wikumChamith · Pull Request #242 · openmrs/openmrs-sdk · GitHub

Thanks all. As @ibacher mentioned, my primary issue was the JDK version. After some research, I installed JDK 1.8 (Java 8) and was able to complete my manual installation.

For reference, this StackOverflow comment has a comprehensive guide to installing multiple versions of Java on your system.

Note: for those using Homebrew, brew install openjdk@8 only works on x86_64 architecture. For ARM, I used the zulu8 cask:

brew tap homebrew/cask-versions
brew install --cask zulu8
2 Likes