eclipse / microprofile-rest-client

MicroProfile Rest Client
Apache License 2.0
140 stars 71 forks source link

The 3.0 TCK Relies on old Jakarta/Java EE Servlet Specification #341

Closed jamezp closed 7 months ago

jamezp commented 2 years ago

The 3.0 TCK relies on Wiremock which in turn relies on Java Servlet 3.0. This is really a problem when testing with the Jakarta EE 9.1 variants. A workaround of trying to upgrade Jetty to use a new version, e.g. 11.0.7, which supports Jakarta Servlet 5.0 results in the following:

java.lang.NoClassDefFoundError: org/eclipse/jetty/server/handler/ContextHandler$NoContext
    at org.eclipse.microprofile.rest.client.tck.sse.HttpSseServer.start(HttpSseServer.java:37)
    at org.eclipse.microprofile.rest.client.tck.sse.AbstractSseTest.lambda$launchServer$0(AbstractSseTest.java:48)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.handler.ContextHandler$NoContext
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 7 more

There appears to be no workaround for this. If you use the older servlet version then TCK tests fail because they can't find the javax.servlet.http.HttpServletResponse. This results in the following tests failing:

[ERROR] Failures: 
[ERROR]   ProxyServerTest>Arquillian.run:138->testProxy:86 » ArquillianProxy jakarta.ws....
[ERROR]   CDIProxyServerTest>Arquillian.run:138->testProxy:76 » ArquillianProxy jakarta....
[ERROR]   TimeoutBuilderIndependentOfMPConfigTest.testConnectTimeout » Test 
Expected ex...
[ERROR]   TimeoutTest.testConnectTimeout » Test 
Expected exception of type class jakart...
[ERROR]   TimeoutViaMPConfigTest.testConnectTimeout » Test 
Expected exception of type c...
[ERROR]   TimeoutViaMPConfigTest.testReadTimeout » Test 
Expected exception of type clas...
[ERROR]   TimeoutViaMPConfigWithConfigKeyTest.testConnectTimeout » Test 
Expected except...
[ERROR]   TimeoutViaMPConfigWithConfigKeyTest.testReadTimeout » Test 
Expected exception...
[INFO] 
[ERROR] Tests run: 225, Failures: 8, Errors: 0, Skipped: 13
andymc12 commented 2 years ago

@jamezp I got this working with RESTEasy on Liberty by specifying the jakarta servlet coordinates (here) for EE9, but using the javax coordinates (here)to work with the existing version of WireMock/Jetty.

Will that work for you?

jamezp commented 2 years ago

@andymc12 I got it working for WildFly as well in a similar manor, but it still strikes me as odd. This may just be what we have to do I suppose for now :)