Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-11703

Upgrade Spring Framework to version 6

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0-M2
    • None
    • None

    Description

      Motivation

      Upgrading Jetty to version 11 requires the API migration of javax.servlet to jakarta.servlet making the Spring Framework 5 incompatible with Jetty 11, as the Spring Framework 5 uses the javax.servlet api. This migration is complete in Spring Framework 6.

      Related Tickets

      Requires:

      • Upgrade Maven Compiler Plugin to support version 61 class files [1]

      Solves: 

      • Upgrade Jetty to version 11 [2]

      Past Related Tickets:

      • Upgrade Spring Framework to 5.3.27 and Spring Security to 5.8.3 

       

      NiFi uses the Spring Framework in conjunction with Jetty, so both need to be upgraded simultaneously, as Spring Framework 5 is incompatible with Jetty 11 because the upgrade of Jetty 9.4.3 to Jetty 11 [2] requires an API migration of javax.servlet to jakarta.servlet, this API is also used by the Spring Framework, which made the same API migration in version 6.

      In attempting to upgrade Jetty to version 11.0.15 [2] and the Spring Framework to 6.0.10 (and Spring Security to 6.1.0), the following errors occurred during the building of NiFi:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project nifi-registry-test: Compilation failure: Compilation failure: 
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10_3DataSourceFactory.java:[19,45] error: cannot access Configuration
      [ERROR]   bad class file: /home/<user>/.m2/repository/org/springframework/spring-context/6.0.10/spring-context-6.0.10.jar(/org/springframework/context/annotation/Configuration.class)
      [ERROR]     class file has wrong version 61.0, should be 55.0
      [ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10_3DataSourceFactory.java:[20,45] error: cannot access Profile
      [ERROR]   bad class file: /home/<user>/.m2/repository/org/springframework/spring-context/6.0.10/spring-context-6.0.10.jar(/org/springframework/context/annotation/Profile.class)
      [ERROR]     class file has wrong version 61.0, should be 55.0
      [ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/TestDataSourceFactory.java:[19,45] error: cannot access Bean
      [ERROR]   bad class file: /home/<user>/.m2/repository/org/springframework/spring-context/6.0.10/spring-context-6.0.10.jar(/org/springframework/context/annotation/Bean.class)
      [ERROR]     class file has wrong version 61.0, should be 55.0
      [ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/TestDataSourceFactory.java:[21,45] error: cannot access Primary
      [ERROR]   bad class file: /home/<user>/.m2/repository/org/springframework/spring-context/6.0.10/spring-context-6.0.10.jar(/org/springframework/context/annotation/Primary.class)
      [ERROR]     class file has wrong version 61.0, should be 55.0
      [ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/TestDataSourceFactory.java:[25,1] error: cannot find symbol
      [ERROR]   symbol: class Configuration
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10_3DataSourceFactory.java:[23,1] error: cannot find symbol
      [ERROR]   symbol: class Configuration
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10_3DataSourceFactory.java:[24,1] error: cannot find symbol
      [ERROR]   symbol: class Profile
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MySql8DataSourceFactory.java:[23,1] error: cannot find symbol
      [ERROR]   symbol: class Configuration
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MySql8DataSourceFactory.java:[24,1] error: cannot find symbol
      [ERROR]   symbol: class Profile
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres13DataSourceFactory.java:[30,1] error: cannot find symbol
      [ERROR]   symbol: class Configuration
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres13DataSourceFactory.java:[31,1] error: cannot find symbol
      [ERROR]   symbol: class Profile
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres11DataSourceFactory.java:[30,1] error: cannot find symbol
      [ERROR]   symbol: class Configuration
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres11DataSourceFactory.java:[31,1] error: cannot find symbol
      [ERROR]   symbol: class Profile
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/DatabaseProfileValueSource.java:[19,42] error: cannot access ProfileValueSource
      [ERROR]   bad class file: /home/<user>/.m2/repository/org/springframework/spring-test/6.0.10/spring-test-6.0.10.jar(/org/springframework/test/annotation/ProfileValueSource.class)
      [ERROR]     class file has wrong version 61.0, should be 55.0
      [ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/DatabaseProfileValueSource.java:[29,51] error: cannot find symbol
      [ERROR]   symbol: class ProfileValueSource
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres14DataSourceFactory.java:[31,1] error: cannot find symbol
      [ERROR]   symbol: class Configuration
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres14DataSourceFactory.java:[32,1] error: cannot find symbol
      [ERROR]   symbol: class Profile
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10DataSourceFactory.java:[23,1] error: cannot find symbol
      [ERROR]   symbol: class Configuration
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10DataSourceFactory.java:[24,1] error: cannot find symbol
      [ERROR]   symbol: class Profile
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres10DataSourceFactory.java:[31,1] error: cannot find symbol
      [ERROR]   symbol: class Configuration
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres10DataSourceFactory.java:[32,1] error: cannot find symbol
      [ERROR]   symbol: class Profile
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10_2DataSourceFactory.java:[23,1] error: cannot find symbol
      [ERROR]   symbol: class Configuration
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10_2DataSourceFactory.java:[24,1] error: cannot find symbol
      [ERROR]   symbol: class Profile
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres12DataSourceFactory.java:[30,1] error: cannot find symbol
      [ERROR]   symbol: class Configuration
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres12DataSourceFactory.java:[31,1] error: cannot find symbol
      [ERROR]   symbol: class Profile
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/TestDataSourceFactory.java:[28,5] error: cannot find symbol
      [ERROR]   symbol:   class Bean
      [ERROR]   location: class TestDataSourceFactory
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/TestDataSourceFactory.java:[29,5] error: cannot find symbol
      [ERROR]   symbol:   class Primary
      [ERROR]   location: class TestDataSourceFactory
      [ERROR] /<path>/<to>/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/DatabaseProfileValueSource.java:[52,4] error: method does not override or implement a method from a supertype
      

       

      There are some required methods and usage changes to get the Spring Framework version 6 migration working, but beyond that, Maven Compiler Plugin [4] is incompatible with version 61 class files and will need to be upgraded to support them.

       

      [1] https://issues.apache.org/jira/browse/MCOMPILER-539

      [2] https://issues.apache.org/jira/browse/NIFI-11702 

      [3] https://issues.apache.org/jira/browse/NIFI-11478

      [4] https://maven.apache.org/plugins/maven-compiler-plugin/

      Attachments

        Issue Links

          Activity

            People

              exceptionfactory David Handermann
              Aerilym Ryan Miller
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 50m
                  1h 50m