diff --git a/pom.xml b/pom.xml index 1de39d622d..3894af3556 100644 --- a/pom.xml +++ b/pom.xml @@ -175,9 +175,9 @@ - javax.servlet - javax.servlet-api - 3.1.0 + jakarta.servlet + jakarta.servlet-api + 4.0.4 junit @@ -243,8 +243,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api provided @@ -556,6 +556,7 @@ + javax.servlet:javax.servlet-api javax.servlet:servlet-api org.sonatype.sisu:sisu-guice log4j:log4j:*:jar:compile diff --git a/src/it/servlet-api/invoker.properties b/src/it/servlet-api/invoker.properties new file mode 100644 index 0000000000..ccb70fca53 --- /dev/null +++ b/src/it/servlet-api/invoker.properties @@ -0,0 +1,3 @@ +# install, not verify, because we want to check the artifact as we would be about to deploy it +# release.skipTests normally set in jenkins-release profile since release:perform would do the tests +invoker.goals=-Dstyle.color=always -ntp -Pjenkins-release -Drelease.skipTests=false clean install diff --git a/src/it/servlet-api/pom.xml b/src/it/servlet-api/pom.xml new file mode 100644 index 0000000000..7d24cd64db --- /dev/null +++ b/src/it/servlet-api/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + org.jenkins-ci.plugins + plugin + @project.version@ + + + org.jenkins-ci.plugins.its + servlet-api + 1.0-SNAPSHOT + hpi + + 2.361.4 + + + + org.jenkins-ci.plugins + structs + 1.5 + + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public/ + + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public/ + + + diff --git a/src/it/servlet-api/src/main/resources/index.jelly b/src/it/servlet-api/src/main/resources/index.jelly new file mode 100644 index 0000000000..2f655e510a --- /dev/null +++ b/src/it/servlet-api/src/main/resources/index.jelly @@ -0,0 +1,2 @@ + +
diff --git a/src/it/servlet-api/src/test/java/test/ServletAPITest.java b/src/it/servlet-api/src/test/java/test/ServletAPITest.java new file mode 100644 index 0000000000..6e8e73cbf9 --- /dev/null +++ b/src/it/servlet-api/src/test/java/test/ServletAPITest.java @@ -0,0 +1,33 @@ +package test; + +import hudson.security.LegacySecurityRealm; +import jenkins.model.Jenkins; +import org.junit.Rule; +import org.junit.Test; +import org.jvnet.hudson.test.JenkinsRule; + +public class ServletAPITest { + + @Rule + public final JenkinsRule rule = new JenkinsRule(); + + /** + * When having both Servlet APIs 3.1 and 4.0 in classpath, the following error + * is logged on server side: + * + *
+     * WARNING	o.e.jetty.server.HttpChannel#handleException: /jenkins/j_security_check
+     * java.lang.AbstractMethodError: Receiver class org.eclipse.jetty.security.authentication.SessionAuthentication does not define or inherit an
+     * implementation of the resolved method 'abstract void valueBound(javax.servlet.http.HttpSessionBindingEvent)' of interface
+     * javax.servlet.http.HttpSessionBindingListener. at org.eclipse.jetty.server.session.Session.bindValue(Session.java:357)
+     * 
+ * + * And then on client side getting "500 Server Error for + * http://localhost:.../jenkins/j_security_check" + */ + @Test + public void involveHttpSessionBindingListener() throws Exception { + Jenkins.get().setSecurityRealm(new LegacySecurityRealm()); + rule.createWebClient().login("bob"); + } +}