Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

ServiceMonitor - Migration

An example application for my book The Java Module System. The Service Monitor is an application that observes a hypothetical network of microservices by

  • contacting individual services
  • collecting and aggregating diagnostic data into statistics
  • persisting statistics
  • making statistics available via REST

It is split into a number of subprojects that focus on specific concerns. Each project has its own directory that contains the known folder structure, e.g. src/main/java.

It was developed as a Java 8 application and now needs to be made compatible with Java 9+ and then be modularized.


Each of the branches contains a different version of the project:

Build and Execution

In the project's root folder:

  • to build: mvn clean install
  • to run: java -cp 'app/*' monitor.Main
  • to contact REST endpoints:
    • curl http://localhost:4567/stats/json
    • curl http://localhost:4567/stats/json64 | base64 -d
    • curl http://localhost:4567/stats/xml


Here's what you're facing. (If you get stuck, check the guide.)

Migration to Java 9

  • internal BASE64Encoder is gone ~> use Base64.getEncoder instead
  • JAXB API is not present ~> add java.xml.bind
  • Common annotations are not present ~> add
  • split package: javax.annotation between and jsr-305 ~> patch
  • old version of Mockito causes warnings ~> update to newer version, e.g. 2.8.47
  • application class loader is no longer a URLClassLoader ~> use system property java.class.path

Migration to Java 10

  • even new version of Mockito may cause problems ~> update to yet newer version, e.g. 2.18.3
  • ASM dependency of Maven compiler plugin may cuase problems ~> update to newer version, e.g. 6.1.1

Migrating to Java 11

  • Java EE modules were removed ~> add third-party dependencies


A demo code base for a Java 9 migration




No releases published


No packages published


You can’t perform that action at this time.