-
-
Notifications
You must be signed in to change notification settings - Fork 489
Geonetwork on Spring 6 codesprint June 2023
- Jose
- Francois
- ...
- Java 11 runtime tests
- Java 17 runtime tests
- Spring 5 and hibernate 5 update
- Spring 6 and hibernate 6 evaluation
Based on https://github.com/geonetwork/core-geonetwork/pull/6276, the application is starting up with:
mvn jetty:run
- from the release build
- from Intellij
Failed to startup in Intellij while using maven 3.8.1. Fixed with maven 3.8.7.
One runtime issue identified:
- Metrics
getOpenFileDescriptorCount
is failing on API call http://localhost:8080/geonetwork/monitor/metrics?pretty=true
HTTP ERROR 500 java.lang.reflect.InaccessibleObjectException:
Unable to make public long
com.sun.management.internal.OperatingSystemImpl.getOpenFileDescriptorCount() accessible:
module jdk.management does not "opens com.sun.management.internal"
to unnamed module @4f7f59dd
Fixed by
--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
GeoNetwork on Java 11 looks to be usable. Question: Do we keep the possibility to build with Java 8 ? or we just move to Java 11 and add a warning if Java >11.
This type of issue is related to the fact that JDK17 does not provide illegal-access
option and the default is like JDK11 --illegal-access=deny
- java.lang
module java.base does not "opens java.lang" to unnamed module
fixed by
--add-opens java.base/java.lang=ALL-UNNAMED
- javax.annotation
Error creating bean with name 'translationPackBuilder' defined in file
[classes/org/fao/geonet/api/tools/i18n/TranslationPackBuilder.class]:
Post-processing of merged bean definition failed; nested exception is
java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'
Moving to jakarta EE9+ as done by Spring 6+
Tested with https://docs.openrewrite.org/recipes/java/migrate/jakarta/javaxannotationmigrationtojakartaannotation:
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
-Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE \
-Drewrite.activeRecipes=org.openrewrite.java.migrate.jakarta.JavaxAnnotationMigrationToJakartaAnnotation
From the release
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
?
In order to run on Java 17+, Spring 6 migration is required (and Spring 6 requires Java 17 and Jakarta EE9).
So it probably means that GeoNetwork will then require at least (to be confirmed):
- maven 3.8.7+
- Java 17
- Tomcat 10
- Jetty 11 and also require that all dependencies used also moved to Jakarta EE9, Spring 6
Update to latest version:
- Spring, Hibernate 5
- Jetty 9
Evaluate Spring 6 migration.
Related documents:
- https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x
- https://spring.io/blog/2022/11/16/spring-framework-6-0-goes-ga
"Spring Framework 6 and Spring Boot 3 based applications will require a minimum of JDK 17 at runtime, as well as a minimum of Tomcat 10 / Jetty 11"
At build time, libraries to add/update:
- Spring
- Hibernate Validator 8.0
- Hibernate ORM 6.3 moved to Jakarta https://hibernate.atlassian.net/browse/HHH-16563?
- Jakarta EE9 javax.annotation > jakarta.annotation, javax.servlet imports to jakarta.servlet jql=project%20%3D%20HHH%20AND%20component%20%3D%20hibernate-jpamodelgen
- Password stored in database / EncryptedStringType not supported by jasypt https://github.com/jasypt/jasypt/issues/147
- Cache / Ehcache 2 to 3 migration https://www.ehcache.org/documentation/3.10/migration-guide.html and https://docs.jboss.org/hibernate/orm/6.2/userguide/html_single/Hibernate_User_Guide.html#caching-provider-jcache-cache-manager
- Java / ReadOnlyMvcInterceptor / Something to remove?
- Java / ServiceManager / Jetty dependency on EofException
- Java / MailUtil / use jakarta.mail.* / Any alternative?
- Spring security / Check openid (getClientRegistration), keycloak (todo), cas (changed to apero instead of casig)
- Wro4J / No support for Spring6 https://github.com/wro4j/wro4j/issues/1135
- HTTP Proxy / Jakarta migration in progress https://github.com/mitre/HTTP-Proxy-Servlet/pull/238#issuecomment-1563728877
- Camel / https://camel.apache.org/blog/2022/05/camel317-whatsnew/
- Jetty on maven plugin/deps/docker
- ...
[WARNING] The POM for com.sun.xml.bind:jaxb-impl:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
One goal is to also update libraries which have CRITICIAL vulnerabilities reported.
- Check github security alerts
- Trivy
cd core-geonetwork
docker pull aquasec/trivy:latest
docker run -v $PWD:/core-geonetwork aquasec/trivy fs --cache-dir /core-geonetwork/.trivycache/ --download-java-db-only
docker run -v $PWD:/core-geonetwork aquasec/trivy fs --cache-dir /core-geonetwork/.trivycache/ --download-db-only
docker run -v $PWD:/core-geonetwork aquasec/trivy \
rootfs --cache-dir /core-geonetwork/.trivycache/ \
--vuln-type library --skip-db-update --scanners vuln --severity CRITICAL \
/core-geonetwork/web/target/geonetwork
# Scanning docker image
docker run -v $PWD:/core-geonetwork aquasec/trivy image --cache-dir /core-geonetwork/.trivycache/ --vuln-type library --skip-db-update --scanners vuln --severity HIGH,CRITICAL geonetwork:4.2.4
- GeoNetwork Java 11 PR https://github.com/geonetwork/core-geonetwork/pull/6276
- geOrchestra PR https://github.com/georchestra/geonetwork/pull/191
If you have some comments, start a discussion, raise an issue or use one of our other communication channels to talk to us.