From 9fbc41f1d5ac0ff8dc3348c3db57200857fe1245 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 2 Oct 2019 23:11:02 +0200 Subject: [PATCH] Fixes #4150 - Module org.eclipse.jetty.alpn.client not found, required by org.eclipse.jetty.proxy Made jetty-alpn-client required by jetty-client. Fixed groupId for test-proxy-webapp. Added test case for the failing configuration. Signed-off-by: Simone Bordet --- jetty-client/pom.xml | 1 - .../src/main/config/modules/client.mod | 1 + jetty-client/src/main/java/module-info.java | 3 +- jetty-distribution/pom.xml | 4 +- .../tests/distribution/DistributionTests.java | 45 +++++++++++++++++++ tests/test-webapps/test-proxy-webapp/pom.xml | 1 - 6 files changed, 49 insertions(+), 6 deletions(-) diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 67c8d231d5a..6947c91b5d7 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -111,7 +111,6 @@ org.eclipse.jetty jetty-alpn-client ${project.version} - true org.eclipse.jetty diff --git a/jetty-client/src/main/config/modules/client.mod b/jetty-client/src/main/config/modules/client.mod index ccc1d50db83..4afc5bcb3d3 100644 --- a/jetty-client/src/main/config/modules/client.mod +++ b/jetty-client/src/main/config/modules/client.mod @@ -5,3 +5,4 @@ Adds the Jetty HTTP client to the server classpath. [lib] lib/jetty-client-${jetty.version}.jar +lib/jetty-alpn-client-${jetty.version}.jar diff --git a/jetty-client/src/main/java/module-info.java b/jetty-client/src/main/java/module-info.java index fcb2b0c2d7f..4ce2f850ae8 100644 --- a/jetty-client/src/main/java/module-info.java +++ b/jetty-client/src/main/java/module-info.java @@ -26,14 +26,13 @@ module org.eclipse.jetty.client exports org.eclipse.jetty.client.proxy; exports org.eclipse.jetty.client.util; + requires org.eclipse.jetty.alpn.client; requires org.eclipse.jetty.http; requires org.eclipse.jetty.io; requires org.eclipse.jetty.util; // Only required if using SPNEGO. requires static java.security.jgss; - // Only required if using the dynamic transport. - requires static org.eclipse.jetty.alpn.client; // Only required if using JMX. requires static org.eclipse.jetty.jmx; } diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 24a1ae4f14c..f6b2843d79e 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -121,7 +121,7 @@ test-spec.war - org.eclipse.jetty + org.eclipse.jetty.tests test-proxy-webapp ${project.version} war @@ -416,7 +416,7 @@ true - org.eclipse.jetty + org.eclipse.jetty.tests test-proxy-webapp war ${project.version} diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java index 6779e9d3ee6..c8c84f635c2 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java @@ -18,14 +18,18 @@ package org.eclipse.jetty.tests.distribution; +import java.io.BufferedWriter; import java.io.File; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.util.concurrent.TimeUnit; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; +import org.eclipse.jetty.client.http.HttpClientTransportOverHTTP; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http2.client.HTTP2Client; import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2; @@ -339,4 +343,45 @@ public class DistributionTests extends AbstractDistributionTest IO.delete(jettyBase.toFile()); } } + + @Test + public void testWebAppWithProxyAndJPMS() throws Exception + { + String jettyVersion = System.getProperty("jettyVersion"); + DistributionTester distribution = DistributionTester.Builder.newInstance() + .jettyVersion(jettyVersion) + .mavenLocalRepository(System.getProperty("mavenRepoPath")) + .build(); + + String[] args1 = { + "--create-startd", + "--add-to-start=http,webapp,deploy,resources" + }; + try (DistributionTester.Run run1 = distribution.start(args1)) + { + assertTrue(run1.awaitFor(5, TimeUnit.SECONDS)); + assertEquals(0, run1.getExitValue()); + + Path logFile = distribution.getJettyBase().resolve("resources").resolve("jetty-logging.properties"); + try (BufferedWriter writer = Files.newBufferedWriter(logFile, StandardCharsets.UTF_8, StandardOpenOption.CREATE)) + { + writer.write("org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog"); + writer.newLine(); + writer.write("org.eclipse.jetty.LEVEL=INFO"); + } + + File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-proxy-webapp:war:" + jettyVersion); + distribution.installWarFile(war, "proxy"); + + int port = distribution.freePort(); + try (DistributionTester.Run run2 = distribution.start("--jpms", "jetty.http.port=" + port, "jetty.server.dumpAfterStart=true")) + { + assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS)); + + startHttpClient(() -> new HttpClient(new HttpClientTransportOverHTTP(1))); + ContentResponse response = client.GET("http://localhost:" + port + "/proxy/current/"); + assertEquals(HttpStatus.OK_200, response.getStatus()); + } + } + } } diff --git a/tests/test-webapps/test-proxy-webapp/pom.xml b/tests/test-webapps/test-proxy-webapp/pom.xml index 97800f44fa7..efd499fa3d0 100644 --- a/tests/test-webapps/test-proxy-webapp/pom.xml +++ b/tests/test-webapps/test-proxy-webapp/pom.xml @@ -7,7 +7,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty test-proxy-webapp Test :: Jetty Proxy Webapp war