I am upgrading some of the libraries in my JEE application, hoping to solve a strange issue (see JAX-RS integration test with Undertow failing in Jenkins but working locally)
While upgrading restEasy, then Weld, my tests are failing because there are some "internal" compilation issues due to the change of namespace from javax.servlet.ServletContext
to jakarta.servlet.ServletContext
:
in my dependencies I have :
in weld-servlet-core 4.0.2.Final :
package org.jboss.weld.environment.undertow;
import io.undertow.servlet.ServletExtension;
import jakarta.servlet.ServletContext;
...
public class WeldServletExtension implements ServletExtension {
@Override
public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) {
...
}
}
and in undertow-servlet 2.2.7.Final :
package io.undertow.servlet;
import io.undertow.servlet.api.DeploymentInfo;
import javax.servlet.ServletContext;
public interface ServletExtension {
void handleDeployment(final DeploymentInfo deploymentInfo, final ServletContext servletContext);
}
This can't work, because WeldServletExtension actually does not implement ServletExtension in that setup : it uses a jakarta.servlet.ServletContext
, while the interface requires the use of javax.servlet.ServletContext
undertow-servlet:2.2.7.Final
is brought transitively by resteasy-undertow:5.0.0.Beta1
(latest version available, from October 2021), and I add myself weld-servlet-core:4.0.2.Final
(also latest version : from July 2021)
Looking at ServletExtension in its main branch, Undertow is still using javax.*
namespace, not jakarta.*
- it hasn't been updated since 2014. So even if I were using Undertow latest version (2.2.12.Final), I would still have the issue
So I am a bit puzzled... what is the trick here ? can't we use Undertow once we upgrade to RestEasy 5.x and use Weld ?