Skip to content

nipafx/demo-java-9-migration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Nicolai Parlog
May 2, 2020
19c8154 · May 2, 2020

History

17 Commits
Jul 23, 2017
Jul 23, 2017
Jul 23, 2017
Jul 23, 2017
Jul 24, 2017
Jul 23, 2017
Jul 24, 2017
Oct 21, 2018
Oct 21, 2018
Jul 23, 2017
Oct 21, 2018
May 2, 2020
Oct 21, 2018
Oct 21, 2018

Repository files navigation

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.

Branches

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

Troubles

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 java.xml.ws.annotations
  • split package: javax.annotation between java.xml.ws.annotations and jsr-305 ~> patch java.xml.ws.annotations
  • 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

About

A demo code base for a Java 9 migration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages