Wolfgang Knauf created TOMEE-4418:
-------------------------------------

             Summary: "arquillian-tomee-remote": SerialVersionUID conflict with 
ServletException
                 Key: TOMEE-4418
                 URL: https://issues.apache.org/jira/browse/TOMEE-4418
             Project: TomEE
          Issue Type: Bug
          Components: TomEE Arquillian Adapters
    Affects Versions: 9.1.3
            Reporter: Wolfgang Knauf


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:

 
{quote}{{<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>}}
{quote}
 

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.
{quote}{{<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>}}
{quote}
 

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 ;).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to