Migrating to Java 11 / Servlet 4.0#
From version 3.0.0, Igloo is now build with Java 11. Igloo also uses API Servlet version 4.0 and it will lead to encoding character issues. Here are some vigilance points to be aware of.
Servlet Version#
Before version 4.0, the character encoding was set by default. Now, it can be customised ; but it needs to be specified manually.
If a character encoding is not specified, the Servlet specification requires that an encoding of ISO-8859-1 is used.
To use UTF-8 in your project :
Update the xsi:schemaLocation and the version in
web.xml:<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_4_0.xsd" version="4.0" metadata-complete="true">
Add character encoding in
web.xml:<request-character-encoding>UTF-8</request-character-encoding> <response-character-encoding>UTF-8</response-character-encoding>
Java Version#
Java 11+ is mandatory for building and running Igloo projects. Update :
Your IDE setting
Your Tomcat configuration (Tomcat 9 required) to run with Java 11
Your maven setting (
JAVA_HOME=/usr/lib/jvm/java-11/ mvn)Your runtime environment (ensure
JAVA_HOMEenvironment setting for your tomcat runtime)Your CI settings (JAVA_HOME, docker image, …)
Update your project#
Update parent pom version
Update
igloo.versionpropertyfix broken imports
fix wrong imports of
jersey.repackagedreplaced withcom.google...de.schlichtherle/TFilereplaced withnet.java.truevfs...
optional - Apache POI: remove
setCellTypecalls (setCellValue automatically override type)optional - Java: replace
Class.newInstance()byClass.getConstructor().newInstance()and addInvocationTargetException | NoSuchMethodException | IllegalArgumentExceptionto the existing catch blockreplace
lifecycle-mappingmaven plugin configuration (used to control how eclipse maps maven plugin lifecycle to eclipse build) by<?m2e ...>XML processing instruction (see https://www.eclipse.org/m2e/documentation/release-notes-17.html#new-syntax-for-specifying-lifecycle-mapping-metadata) This instruction may be added at<plugin>or<execution>level
Maven plugins#
Compiler and processor plugin uses --release option to force java 11 usage. Check you do not
override these setttings.
Dependencies#
Several dependencies have been updated to Java 11-mandatory versions :
bindgen : expected >= 5.0.0
bindgen-bindings-java : expected >= 2.0.0
bindgen-java : expected >= 2.0.0
maven-processor-plugin : expected >= 4.4
jersey : expected >= 2.32
querydsl : expected >= 5.0.0
Be careful with these if you have one of them in a custom version.
Jersey#
Jersey has been updated from jersey-spring3 to jersey-spring5. This update had several effects :
Jersey do not longer repackage guava, so you have to refactor your
jersey.repackagedimports if you have some and directly import guava.Due to some version conflicts with
jackson-module-jaxb-annotationsandhk2-utils/runlevel,jakarta-xml-bind-api,jakarta-activation-apiandjakarta-annotation-apiversions are now manually declared.
javax.annotations#
From Java 9, javax.annotation is reworked.
javax.annotationlinked to injection management (@PostConstruct, @Managed) are moved in an external dependency,javax.annotation:javax.annotation-api. In Igloo context, this dependency is used when Spring beans are managed viajavax.annotationannotations.JSR 305
javax.annotationare removed (@Nonnull, …); we use insteadcom.google.code.findbugs:jsr305dependency.javax.annotation.Generatedis replaced by runtime-providedjavax.annotation.processing.Generated(updated bindgen version, querydsl 5.0.0 with custom configuration).
In your projects :
If you encounter spring initialization problems with missing Spring beans, add a scope-provided
javax.annotation:javax.annotation-apidependency (this dependency is provided by tomcat container).If you have
javax.annotation.Generatedreferences, regenerate code or search for an updated andjavax.annotation.processing.Generated-friendly dependency.