Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-4418

"arquillian-tomee-remote": SerialVersionUID conflict with ServletException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 9.1.3, 10.0.0-M2
    • None
    • None

    Description

      When updating a project to JakartaEE and TomEE 9, I noticed this problem: the project has one unit test that triggers a ServletException on the server side, which is caught, serialized and deserialized on the client side.

      The client side is a unit test driven by "arquillian-tomee-remote".

      Unfortunately, the underlying Tomcat library (https://repo.maven.apache.org/maven2/org/apache/tomcat/tomcat-servlet-api/10.0.27/tomcat-servlet-api-10.0.27.jar) contains a ServletException with a SerialVersionID of "1", which is not the same as the version in the JakartaEE reference implementation.

      Now the problem: my test project has those dependencies:

       

      <dependency>
        <groupId>org.apache.tomee</groupId>
        <artifactId>arquillian-tomee-remote</artifactId>
        <version>9.1.3</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-servlet-api</artifactId>
        <scope>provided</scope>
        <version>10.0.27</version>
      </dependency>

       

      With the previous version, this worked. But with the new arquillian adapter, it pulls in https://repo.maven.apache.org/maven2/org/apache/tomee/jakartaee-api/9.1.1/jakartaee-api-9.1.1.jar , which also contains a ServletException, but with a different SerialVersionUID.

      Thus, the test fails:

      class java.io.InvalidClassException: jakarta.servlet.ServletException; local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = 4221302886851315160

       

      My workaround: exclude "org.apache.tomee:jakartaee-api" from the arquillian adapter, then add it back after declaring the Tomcat servlet api (the one with the "1" SerialVersionUID). It seems the ServletException is now loaded from the first jar, and my test works.

      <dependency>
        <groupId>org.apache.tomee</groupId>
        <artifactId>arquillian-tomee-remote</artifactId>
        <version>9.1.3</version>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>org.apache.tomee</groupId>
            <artifactId>jakartaee-api</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-servlet-api</artifactId>
        <scope>provided</scope>
        <version>10.0.27</version>
      </dependency>
      <dependency>
        <groupId>org.apache.tomee</groupId>
        <artifactId>jakartaee-api</artifactId>
        <scope>provided</scope>
        <version>9.1.1</version>
      </dependency>

       

      I have no idea whether this is anything that you could change. It would work if the arquillian adapter would pull the tomcat servlet api first. Or the Tomcat guys could fix the SerialVersionUID .

      Attachments

        Activity

          People

            Unassigned Unassigned
            wknauf Wolfgang Knauf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: