Migration java 8 to 11. java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener

2.9k views Asked by At
  • I am migrating an application from java8 to java11, the changes I have made are :
  1. I updated the maven compiler.version from 3.3 to 3.8.0
  2. I updated the maven compiler.source from 1.8 to 11
  3. I updated the maven compiler.target from 1.8 to 11
  4. I replaced the javax dependencies with the corresponding jakarta ones, I followed the instructions in this post.
  • I am using Eclipse and Glassfish 6.1.0, in glassfish I have to add some libraries that are important for the project, but I have had problems adding the commons-fileupload one, I found that the Apache Commons code that uses the javax package. * package does not compile with Jakarta EE 9 and GlassFish 6.1.0 code and the commons-fileupload depends on javax.servlet and the GlassFish admin console uses it to load implementations.

  • Also, I'm working with:

    • JDK 11
    • GWT Eclipse Plugin 2.8.1
    • Eclipse 2021-03 (4.19.0) Build id: 20210312-0638
    • Glassfish 6.1.0

When I try to deploy the application I get this error:

[2021-12-07T14:34:55.416-0500] [glassfish 6.1] [SEVERE] [AS-WEB-CORE-00108] [jakarta.enterprise.web.core] [tid: _ThreadID=47 _ThreadName=admin-listener(3)] [timeMillis: 1638905695416] [levelValue: 1000] [[
  ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5537)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:507)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:877)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:860)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:644)
... 
Caused by: java.lang.IllegalArgumentException: java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
    at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2867)
    at org.apache.catalina.core.StandardContext.addApplicationListener(StandardContext.java:2073)
    at com.sun.enterprise.web.TomcatDeploymentConfig.configureApplicationListener(TomcatDeploymentConfig.java:212)
    at com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:71)
    at com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:215)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:295)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:122)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5534)
    ... 73 more


I attached both full pom.xml and server¨log files.

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.focussscm</groupId>
    <artifactId>focussSCMParent</artifactId>
    <version>5.5.0</version>
    <packaging>pom</packaging>


    <modules>
        <module>../focussSCMModel</module>
        <module>../focussSCMJobsWSClientJobService</module>
        <module>../focussWSClientDataExchangeService</module>
        <module>../focussSCMBusiness</module>
        <module>../focussSCMJobs</module>
        <module>../focussSCMSecurity</module>
        <module>../focussSCM</module>
    </modules>

    <properties>
        <!-- Explictly specify a default encoding to avoid relying on the OS locale. -->
        <project.build.sourceEncoding>Cp1252</project.build.sourceEncoding>
        <project.build.scriptEncoding>Cp1252</project.build.scriptEncoding>

        <!-- Artifact versions -->
        <axis.version>1.4</axis.version>
        <commons-fileupload.version>1.4</commons-fileupload.version>
        <commons.discovery.version>0.2</commons.discovery.version>
        <gwt.version>2.9.0</gwt.version>
        <gwt-highcharts.version>1.7.0</gwt-highcharts.version>
        <gwtext.version>2.0.5</gwtext.version>
        <itext.version>5.4.2</itext.version>
        <jackson.version>1.8.10</jackson.version>
        <jakarta-faces.version>3.0.2</jakarta-faces.version>
        <jakarta.ws.rs.version>3.0.0</jakarta.ws.rs.version>
        <jakarta.xml.ws.version>4.0.0-RC1</jakarta.xml.ws.version>
        <jakarta.mail.version>2.0.1</jakarta.mail.version>
        <jakarta.ejb.version>4.0.0</jakarta.ejb.version>
        <jakarta.activation-api.version>2.0.1</jakarta.activation-api.version>
        <javax.wsdl.version>1.5.1</javax.wsdl.version>
        <jakarta.jws-api.version>3.0.0</jakarta.jws-api.version>
        <jakartarpc-api.version>1.1.4</jakartarpc-api.version>
        <jms.version>1.1</jms.version>
        <jmxri.version>1.2.1</jmxri.version>
        <jmxtools.version>1.2.1</jmxtools.version>
        <json.version>20171018</json.version>
        <jstl.version>1.2</jstl.version>
        <log4j.version>1.2.17</log4j.version>
        <poi.version>3.9</poi.version>
        <org.quartz-scheduler.version>1.5.2</org.quartz-scheduler.version>
        <servlet-api.version>5.0.0</servlet-api.version>
        <smartgwt.version>4.0-focuss</smartgwt.version>
        
        <spring.version>5.2.8.RELEASE</spring.version>
        <spring.security.version>5.3.4.RELEASE</spring.security.version>
        <slf4j-log4j.version>1.8.0-beta4</slf4j-log4j.version>
        
        <spring-security-web.version>3.1.4.RELEASE</spring-security-web.version>
        <spring-webmvc.version>3.0.7.RELEASE</spring-webmvc.version>
        <gwt.directory>pages/module/gwt</gwt.directory>

        <!-- Glassfish server variables -->  
`<glassfish.glassfishDirectory>C:\Development\Apps\Glassfish6</glassfish.glassfishDirectory>`
        <glassfish.user>User</glassfish.user>
        <glassfish.adminPassword>123456</glassfish.adminPassword>
        <glassfish.domain.name>fscmFocuss</glassfish.domain.name>
        <glassfish.domain.host>localhost</glassfish.domain.host>
        <glassfish.domain.adminPort>1234</glassfish.domain.adminPort>


        <!-- Maven GWT compiler version and parameters -->
        <maven.compiler.version>3.8.0</maven.compiler.version>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <maven.resources.version>3.2.0</maven.resources.version>
        <compiler.style>OBF</compiler.style>
        <compiler.log.level>INFO</compiler.log.level>
        <glassfish.port>8081</glassfish.port>
        <install.plugin.version>2.5.2</install.plugin.version>

        <!-- Maven War plugin version and parameters -->
        <war.plugin.version>3.0.0</war.plugin.version>

        <!-- Maven ear plugin version and parameters -->
        <ear.plugin.version>2.10.1</ear.plugin.version>

        <cargo.maven3.plugin.version>1.9.3</cargo.maven3.plugin.version>
        
        <!-- ${basedir}/local.properties -->
        <dropbox.home>${dropbox.home.dir}</dropbox.home>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- package\GWT\gwt-servlet.jar -->
            <!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-servlet -->
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-servlet</artifactId>
                <version>${gwt.version}</version>
                <scope>runtime</scope>
            </dependency>

            <!-- only_for_building\gwt\gwt-2.5.1\gwt-user.jar -->
            <!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-user -->
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-user</artifactId>
                <version>${gwt.version}</version>
                <scope>provided</scope>
            </dependency>

            <!-- https://mvnrepository.com/artifact/com.gwtext/gwtext -->
            <dependency>
                <groupId>com.gwtext</groupId>
                <artifactId>gwtext</artifactId>
                <version>${gwtext.version}</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-dev -->
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-dev</artifactId>
                <version>${gwt.version}</version>
                <scope>provided</scope>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-dev -->
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt</artifactId>
                <version>${gwt.version}</version>
                <type>pom</type>
            </dependency>
                        
            <!-- only_for_building\gwt\smartgwtpro-4.0\lib -->
            <dependency>
                <groupId>com.isomorphic.smartgwt.pro</groupId>
                <artifactId>smartgwt-pro</artifactId>
                <version>${smartgwt.version}</version>
                <exclusions>
                    <!-- Exclusion: required to avoid conflicting with the asm dependency below -->
                    <exclusion>
                        <groupId>asm</groupId>
                        <artifactId>asm</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- only_for_building\gwt\HighCharts\org.moxieapps.gwt.highcharts-1.5.0.jar -->
            <!-- https://highcharts4gwt.github.io/ -->
            <dependency>
                <groupId>org.moxieapps.gwt</groupId>
                <artifactId>org.moxieapps.gwt.highcharts</artifactId>
                <version>${gwt-highcharts.version}</version>
            </dependency>           

            <!-- only_for_building\axis\axis.jar -->
            <!-- https://mvnrepository.com/artifact/org.apache.axis/axis -->
            <dependency>
                <groupId>org.apache.axis</groupId>
                <artifactId>axis</artifactId>
                <version>${axis.version}</version>
            </dependency>

            <!-- only_for_building\itextpdf-5.4.2 -->
            <!-- https://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
            <dependency>
                <groupId>com.itextpdf</groupId>
                <artifactId>itextpdf</artifactId>
                <version>${itext.version}</version>
            </dependency>

            <!-- only_for_building\log4j\log4j-1.2.15.jar -->
            <!-- https://mvnrepository.com/artifact/log4j/log4j -->
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>${log4j.version}</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
            <!-- <dependency> -->
            <!-- <groupId>org.apache.logging.log4j</groupId> -->
            <!-- <artifactId>log4j-core</artifactId> -->
            <!-- <version>${log4j.version}</version> -->
            <!-- </dependency> -->

            <!-- only_for_building\poi-3.9 -->
            <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
            <dependency>
                <groupId>org.apache.poi</groupId>
                <artifactId>poi</artifactId>
                <version>${poi.version}</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
            <dependency>
                <groupId>org.apache.poi</groupId>
                <artifactId>poi-ooxml</artifactId>
                <version>${poi.version}</version>
            </dependency>

            <!-- package\json -->
            <!-- https://mvnrepository.com/artifact/org.codehaus.jackson/jackson-core-lgpl -->
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-core-lgpl</artifactId>
                <version>${jackson.version}</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.codehaus.jackson/jackson-mapper-lgpl -->
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-mapper-lgpl</artifactId>
                <version>${jackson.version}</version>
            </dependency>

            <!-- only_for_building\json -->
            <!-- https://mvnrepository.com/artifact/org.json/json -->
            <dependency>
                <groupId>org.json</groupId>
                <artifactId>json</artifactId>
                <version>${json.version}</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/jakarta.xml.rpc/jakarta.xml.rpc-api -->
            <dependency>
                <groupId>jakarta.xml.rpc</groupId>
                <artifactId>jakarta.xml.rpc-api</artifactId>
                <version>${jakartarpc-api.version}</version>
            </dependency>


            <!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
            <dependency>
                <groupId>jakarta.servlet</groupId>
                <artifactId>jakarta.servlet-api</artifactId>
                <version>${servlet-api.version}</version>
                <scope>provided</scope>
            </dependency>


            <!-- https://mvnrepository.com/artifact/jakarta.ws.rs/jakarta.ws.rs-api -->
            <dependency>
                <groupId>jakarta.ws.rs</groupId>
                <artifactId>jakarta.ws.rs-api</artifactId>
                <version>${jakarta.ws.rs.version}</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/jakarta.xml.ws/jakarta.xml.ws-api -->
            <dependency>
                <groupId>jakarta.xml.ws</groupId>
                <artifactId>jakarta.xml.ws-api</artifactId>
                <version>${jakarta.xml.ws.version}</version>
            </dependency>       


            <!-- https://mvnrepository.com/artifact/jakarta.mail/jakarta.mail-api -->
            <dependency>
                <groupId>jakarta.mail</groupId>
                <artifactId>jakarta.mail-api</artifactId>
                <version>${jakarta.mail.version}</version>
            </dependency>


            <!-- https://mvnrepository.com/artifact/jakarta.ejb/jakarta.ejb-api -->
            <dependency>
                <groupId>jakarta.ejb</groupId>
                <artifactId>jakarta.ejb-api</artifactId>
                <version>${jakarta.ejb.version}</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/jakarta.jws/jakarta.jws-api -->
            <dependency>
                <groupId>jakarta.jws</groupId>
                <artifactId>jakarta.jws-api</artifactId>
                <version>${jakarta.jws-api.version}</version>
            </dependency>
            
            <!-- https://mvnrepository.com/artifact/jakarta.activation/jakarta.activation-api -->
            <dependency>
                <groupId>jakarta.activation</groupId>
                <artifactId>jakarta.activation-api</artifactId>
                <version>${jakarta.activation-api.version}</version>
            </dependency>       


            <!-- https://mvnrepository.com/artifact/org.glassfish/jakarta.faces -->
            <dependency>
                <groupId>org.glassfish</groupId>
                <artifactId>jakarta.faces</artifactId>
                <version>${jakarta-faces.version}</version>
            </dependency>                           
                        

            <!-- package\fileUpload\commons-fileupload-1.4.jar -->
            <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
            <dependency>
                <groupId>commons-fileupload</groupId>
                <artifactId>commons-fileupload</artifactId>
                <version>${commons-fileupload.version}</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
            <!-- <dependency> -->
            <!-- <groupId>org.quartz-scheduler</groupId> -->
            <!-- <artifactId>quartz</artifactId> -->
            <!-- <version>${org.quartz-scheduler.version}</version> -->
            <!-- </dependency> -->

            <!-- https://mvnrepository.com/artifact/opensymphony/quartz -->
            <dependency>
                <groupId>opensymphony</groupId>
                <artifactId>quartz</artifactId>
                <version>${org.quartz-scheduler.version}</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
            <!-- <dependency> -->
            <!-- <groupId>org.quartz-scheduler</groupId> -->
            <!-- <artifactId>quartz</artifactId> -->
            <!-- <version>${org.quartz-scheduler.version}</version> -->
            <!-- </dependency> -->
            
            <!-- https://mvnrepository.com/artifact/commons-discovery/commons-discovery -->
            <dependency>
                <groupId>commons-discovery</groupId>
                <artifactId>commons-discovery</artifactId>
                <version>${commons.discovery.version}</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.eclipse.birt.runtime.3_7_1/javax.wsdl -->
            <dependency>
                <groupId>org.eclipse.birt.runtime.3_7_1</groupId>
                <artifactId>javax.wsdl</artifactId>
                <version>${javax.wsdl.version}</version>
            </dependency>

            <!-- Security: Spring Core -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${spring.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${spring.version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
                <version>${spring.version}</version>
            </dependency>
    
            <!-- Security: Spring Security -->
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-config</artifactId>
                <version>${spring.security.version}</version>
            </dependency>
            
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-web</artifactId>
                <version>${spring.security.version}</version>
            </dependency>
                    
            <!-- Logging: Slf4j -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
                <version>${slf4j-log4j.version}</version>
            </dependency>
        
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j-log4j.version}</version>
            </dependency>
        
            <dependency>
                <groupId>jstl</groupId>
                <artifactId>jstl</artifactId>
                <version>${jstl.version}</version>
                <scope>provided</scope>
            </dependency>
            <!-- New -->
 
            <!-- https://mvnrepository.com/artifact/org.codehaus.cargo/cargo-maven2-plugin -->
            <dependency>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven3-plugin</artifactId>
                <version>${cargo.maven3.plugin.version}</version>
            </dependency>
            
        </dependencies>
    </dependencyManagement>

    <build>

        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>src</directory>
                <excludes>
                    <exclude>*/.java</exclude>
                </excludes>
            </resource>
        </resources>

        <plugins>
            <!-- Plugin to compile the project. Included here only to specifically 
                define the source and target versions of the project. Usage: mvn compile 
                (will compile java files to classes) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.version}</version>
                <configuration>                 
                    <source>${maven.compiler.source}</source>                   
                    <target>${maven.compiler.target}</target>                   
                </configuration>            

            </plugin>
            
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.2.14.v20151106</version>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                  <artifactId>maven-resources-plugin</artifactId>
                  <version>2.6</version>
                </plugin> 
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${install.plugin.version}</version>
                </plugin>
        
                <!-- Plugin to compile GWT Java code to JavaScript. Usage: mvn gwt:compile 
                    (will compile GWT files to JavaScript) -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>gwt-maven-plugin</artifactId>
                    <version>${gwt.version}</version>
                    <executions>
                        <execution>
                            <id>compile</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>compile</goal>
                                <goal>test</goal>
                            </goals>
                        </execution>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>generateAsync</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <!-- Compiler parameters -->
                        <extraJvmArgs>-Xmx1024m -Xss1024k -Dgwt.nowarn.legacy.tools</extraJvmArgs>
                        <draftCompile>true</draftCompile>
                        <debugSuspend>false</debugSuspend>
                        <logLevel>${compiler.log.level}</logLevel>
                        <style>${compiler.style}</style>
                        <!-- Launch parameters with external server -->
                        <!-- Add the app to Glassfish embedded server and set the server to 
                            publsh automatically after each compile -->
                        <noServer>true</noServer>
                        <!-- Build parameters -->
                        <webappDirectory>${project.build.directory}/${project.build.finalName}/${gwt.directory}</webappDirectory>
                        <deploy>${project.build.directory}/${project.build.finalName}/${gwt.directory}</deploy>
                    </configuration>
                </plugin>

                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${war.plugin.version}</version>
                    <configuration>
                        <warSourceDirectory>WebContent</warSourceDirectory>
                    </configuration>
                </plugin>

            
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven3-plugin</artifactId>
                    <configuration>
                        <container>
                            <containerId>glassfish4x</containerId>
                            <type>installed</type>
                            <!-- Path to directory where glassfish is installed -->
                            <home>${glassfish.glassfishDirectory}</home>
                        </container>
                        <configuration>
                            <type>existing</type>
                            <!-- Path to domains directory -->
                            <home>${glassfish.glassfishDirectory}/glassfish/domains</home>
                            <properties>
                                <!-- Domain name where application will be deployed. -->
                                <cargo.glassfish.domain.name>${glassfish.domain.name}</cargo.glassfish.domain.name>
                                <!-- Glassfish host -->
                                <cargo.hostname>${glassfish.domain.host}</cargo.hostname>
                                <!-- Glassfish admin port -->
                                <cargo.glassfish.admin.port>${glassfish.domain.adminPort}</cargo.glassfish.admin.port>
                                <!-- Glassfish user to authenticate -->
                                <cargo.remote.username>admin</cargo.remote.username>
                                <!-- Glassfish password to authenticate -->
                                <cargo.remote.password>${glassfish.adminPassword}</cargo.remote.password>
                            </properties>
                        </configuration>
                    </configuration>
                </plugin>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>gwt-maven-plugin</artifactId>
                                        <versionRange>[2.8.0,)</versionRange>
                                        <goals>
                                            <goal>compile</goal>
                                            <goal>site</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>properties-maven-plugin</artifactId>
                    <version>1.0.0</version>
                  
                    <executions>
                        <execution>
                            <phase>initialize</phase>
                            <goals>
                                <goal>read-project-properties</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
1

There are 1 answers

0
Stephen C On

Your problems stem from the incompatibility between the Java EE 8 or earlier versus Jakarta EE 9 or later.

It looks the most recent official release of Apache Commons FileUpload still depends on the Java EE APIs. However, looking at the commit history on GitHub, this commit:

purports to remove Java EE and Jakarta EE dependencies from the Java code. So, if were to check out the source at that commit or later, you should be able to build a version of commons-fileupload that will run on either Java EE or Jakarta EE.

(Note: I haven't tried this out.)

Reading between the lines, I expect that will be a new official release of this library fairly soon. Apparently, the Java EE dependency in commons-fileupload is a blocker for some other Apache Foundation projects.


The other alternative would be to keep your application at Java EE 8 (or earlier) for now, and use GlassFish 5.1 or earlier ... which requires Java 8 rather than Java 11.