When using an extension or community module that uses hibernate, there seems to be a strict backward-incompatibility in the ANTLR 4 library.
-
Hibernate 7 Upgrade: GeoServer recently upgraded to
hibernate-core:7.4.5.Final. This version of Hibernate depends onantlr4-runtime:4.13.2. ANTLR 4.13.x serializes its internal Abstract Syntax Trees (ATN) using version 4 of its format. -
Jiffle Dependency: GeoTools and GeoServer (specifically the raster processing modules) heavily rely on
org.eclipse.imagen:jiffle-language:0.9.2(the OSGeo Jiffle library). This library was compiled againstantlr4-runtime:4.7.1, which uses version 3 of the ATN format. -
The Conflict: ANTLR 4 strictly refuses to parse older or newer ATN data.
-
When Tomcat loads the webapp, the classloader picked up the older
antlr4-runtime-4.7.1.jar. -
When Hibernate starts and tries to initialize its parsing lexer, it passes its version 4 ATN data to the version 3
ATNDeserializerfrom the 4.7.1 jar. -
The deserializer complains:
Could not deserialize ATN with version 4 (expected 3)and crashes the application context.
-
I can resolve the issue locally by upgrading JIFFLE in geotools. I can make a ticket and PR for this, unless there is a reason not to do this?