Skip to content

nipafx/demo-java-9-migration

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
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.

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