GCube Java 8 migration guide

From Gcube Wiki
Revision as of 10:31, 17 February 2017 by Mariadigirolamo (Talk | contribs) (Other Incompatibilities - TO COMPLETE)

Jump to: navigation, search

This page collects the guidelines for the migration of D4Science infrastructure and the gCUbe software from Java 7 to Java 8. It also collects common issues (and their solution) experienced during the migration as reference for all gCube developers.

There are (few) documented incompatibilities between Java 7 and Java 8.

Running into one of them will require to re-factor the component and release a new version of it.

Java 8 compatibility guide: http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html

Source Code

Source Incompatibilities - TO COMPLETE

  • Detected at integration time (the component does not build)
  • animal-sniffer-maven-plugin can be used by developers to detect them at development time

Dependencies

Some third-party libraries are not compiled in Java 8 and their code is not Java 8 compatible. This is usually the case of very old versions.

  • lombok
    • not compatible: 0.11.6
    • suggested: 1.14.8

Behaviour Incompatibilities - TO COMPLETE

  • Cannot be detected at development and integration time
  • We will need to carefully test our artifacts

Other Incompatibilities - TO COMPLETE

  1. TOMCAT incopatibilities

Java8 required as pre-requisited the latest TOMCAT version as reported in the https://support.d4science.org/issues/6306: "Moving to the latest tomcat version is not so easy. We want to stuck with the distribution provided tomcat for a lot of reasons:

  • backport of bug and security fixes
  • compatibility with the apr libraries
  • In addition to that, the javassist exceptions were a cosmetic only problem in the past, and an upgrade to a newer version of javassist was planned.

" The solution is :

  • for gCore : updating the xerces and xml-api libraries to make the gCore services working;
  • for Smartgears: upgrade on ubuntu 14.04 all the development and production infrastructure. This should be resolved the problems manifested for the javassist and xml parsing.
Due to the split of the release in gCore and Smartgear components the migration and possible 
resolution of the issue are provided both.
  1. Incompatibilities during the updating of the registry service (node9-d-d4s) #6306.

In particular the issue occurred after the replacing of Xerces and xml-api libraries, where the gCore container doesn't start with the following exception:

2017-02-16 17:20:20,037 FATAL contexts.GHNContext [Initialiser,fatal:76] [0.663s] GHNContext: gHN could not complete initialisation
java.lang.NoSuchMethodError: org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar([Lorg/apache/xerces/xni/parser/XMLInputSource;)V
        at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
        at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:638)
        at org.gcube.common.resources.kxml.KGCUBEResource.getSchema(KGCUBEResource.java:170)
        at org.gcube.common.resources.kxml.KGCUBEResource.load(KGCUBEResource.java:80)
        at org.gcube.common.resources.kxml.node.KGCUBEHostingNode.load(KGCUBEHostingNode.java:18)
        at org.gcube.common.core.contexts.GHNContext.loadGHNResource(GHNContext.java:405)
        at org.gcube.common.core.contexts.GHNContext.configureGHNResource(GHNContext.java:384)
        at org.gcube.common.core.contexts.GHNContext.initialise(GHNContext.java:291)
        at org.gcube.common.core.contexts.GHNContext.<clinit>(GHNContext.java:261)
        at org.gcube.common.core.contexts.GCUBEServiceContext$Initialiser.onRIDeployed(GCUBEServiceContext.java:677)
        at org.gcube.common.core.contexts.service.Consumer.onEvent(Consumer.java:30)
        at org.gcube.common.core.utils.events.GCUBEProducer$2.run(GCUBEProducer.java:176)

Solution: -to update -

JVM - TO COMPLETE

JVM memory management changed in Java 8: concept of PermGen space has been replaced by Metaspace. As consequence, startup options used in Java 7 (e.g. "-XX:MaxPermSize") rae not valid anymore in JVM 8.

Set Java 8 as the default JVM for all the development servers managed by Ansible. A new provisioning run is needed to install the new packages and reconfigure the services. On the smartgears-based nodes this can be done running the playbook(s) with the tags: jdk,tomcat

List of the nodes migrated:

  • node26.d.d4science.research-infrastructures.eu migrated (no java app running on this host)
  • node24.d.d4science.research-infrastructures.eu migrated (smartgears or ghn was not running on this host, only postgresql)
  • node27.d.d4science.research-infrastructures.eu migrated (old smartgears tomcat restarted with java8)
  • obis2.i-marine.research-infrastructures.eu alias geoserver-dev2.d4science-ii.research-infrastructures.eu migrated (no java app running on this host, only postgresql)
  • dev.d4science.org migrated (no java app running on this host, only postgresql)

To migrate old ghn dev (ubuntu 8.04) as node1.d.d4science , node4.d.d4science , node5.d.d4science, new nodes are created :

  • node9-d-d4s.d4science.org (registry service)
  • node4.d.d4science
  • node5.d.d4science

To migrate the olg ghn dev to Java8 the first step is update the old OS :

  • node11.d.d4science.research-infrastructures.eu : Ubuntu 9.04 32-bit
  • node13.d.d4science.research-infrastructures.eu : Ubuntu 9.04 32-bit
  • node20.d.d4science.research-infrastructures.eu : Ubuntu 9.04 32-bit
  • node15.d.d4science.research-infrastructures.eu : Ubuntu 9.10 64-bit

The first step has been creating a new hosts:

  • node11-d-d4s.d4science.org (replaced node11.d.d4science)

TO UPDATE

*node12-d-d4s.d4science.org (it'll replace node13.d.d4science.research-infrastructures.eu)
*node13-d-d4s.d4science.org (it'll replace node15.d.d4science.research-infrastructures.eu)
*node14-d-d4s.d4science.org (it'll replace node20.d.d4science.research-infrastructures.eu)

References

  • Oracle releases plan

http://www.oracle.com/technetwork/java/eol-135779.html

  • Compatibility guide

http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html

  • Animal Sniffer Plugin Guide

https://blog.gvsig.org/2011/07/25/hunting-api-incompatibilities-with-the-animal-sniffer-project/