Summary: | Import as remote by url fails. | ||
---|---|---|---|
Product: | Ant | Reporter: | Tomáš <tom.opichal> |
Component: | Build Process | Assignee: | Ant Notifications List <notifications> |
Status: | RESOLVED WORKSFORME | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 1.10.7 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: | Build file to reproduce the issue |
Description
Tomáš
2020-04-09 13:10:37 UTC
This looks like some server side change/policy that that URL might have placed. I can access that URL from browser, curl and wget but when Ant tries it from Java code, it's receiving a 403 error. In fact, even the following trivial Java program (which is almost what Ant does internally) results in a 403: import java.net.URL; import java.io.InputStream; public class Fetch { public static void main(final String[] args) throws Exception { final URL targetURL = new URL("https://gitlab.com/MedisoArt/public/java-commons/raw/master/build.xml"); try (final InputStream is = targetURL.openConnection().getInputStream()) { is.read(); } System.out.println("Done"); } } You might have to talk to whoever manages that URL to understand what restrictions are in place to access that URL (and what changed on 23 March 2020). Maybe they are using some request headers to decide whether or not to allow access to the resource. This is the error that I get when I run that trivial Java program: Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: https://gitlab.com/MedisoArt/public/java-commons/raw/master/build.xml at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268) It works with Java 14 but not with Java 8. It seems some server side configuration is prohibiting Java8 - the TLS handshake looks fine, though. |