You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Johan Compagner (Jira)" <ji...@apache.org> on 2022/08/23 16:41:00 UTC
[jira] [Updated] (HTTPCORE-724) org.apache.hc.core5.util.ReflectionUtils us using illegal reflective access
[ https://issues.apache.org/jira/browse/HTTPCORE-724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johan Compagner updated HTTPCORE-724:
-------------------------------------
Description:
a basic example:
{code:java}
public class Main {
public static void main(String[] args) throws IOException, InterruptedException, ExecutionException, NoSuchAlgorithmException {
System.err.println(String.join(" ", SSLContext.getDefault().getSupportedSSLParameters().getProtocols()));
try (CloseableHttpAsyncClient client = HttpAsyncClients.createDefault()) {
client.start();
SimpleHttpRequest request1 = SimpleRequestBuilder.get("https://www.google.com/").build();
Future<SimpleHttpResponse> future = client.execute(request1, null);
// and wait until response is received
SimpleHttpResponse response1 = future.get();
System.out.println(request1.getRequestUri() + "->" + response1.getCode());
};
}
{code}
does not work under java 16 or higher
in java 16 you can get around it by using:
--illegal-access=permit
but in java 17 that is not allowed anymore, that is ignored.
if you run it with java 15 you will get:
WARNING: Illegal reflective access by org.apache.hc.core5.util.ReflectionUtils$1 ([file:/C:/workspace_master/HttpTest/lib/httpcore5-5.1.4.jar|file:///C:/workspace_master/HttpTest/lib/httpcore5-5.1.4.jar]) to method sun.security.ssl.SSLEngineImpl.getApplicationProtocol()
and after that line if i enabled wire logging everything goes different, (i think java 16/17 then just try todo http1.1)
was:
a basic example:
public static void main(String[] args) throws IOException, InterruptedException, ExecutionException, NoSuchAlgorithmException {
System.err.println(String.join(" ", SSLContext.getDefault().getSupportedSSLParameters().getProtocols()));
try (CloseableHttpAsyncClient client = HttpAsyncClients.createDefault()) {
client.start();
SimpleHttpRequest request1 = SimpleRequestBuilder.get("https://www.google.com/").build();
Future<SimpleHttpResponse> future = client.execute(request1, null);
// and wait until response is received
SimpleHttpResponse response1 = future.get();
System.out.println(request1.getRequestUri() + "->" + response1.getCode());
};
}
does not work under java 16 or higher
in java 16 you can get around it by using:
--illegal-access=permit
but in java 17 that is not allowed anymore, that is ignored.
if you run it with java 15 you will get:
WARNING: Illegal reflective access by org.apache.hc.core5.util.ReflectionUtils$1 (file:/C:/workspace_master/HttpTest/lib/httpcore5-5.1.4.jar) to method sun.security.ssl.SSLEngineImpl.getApplicationProtocol()
and after that line if i enabled wire logging everything goes different, (i think java 16/17 then just try todo http1.1)
> org.apache.hc.core5.util.ReflectionUtils us using illegal reflective access
> ---------------------------------------------------------------------------
>
> Key: HTTPCORE-724
> URL: https://issues.apache.org/jira/browse/HTTPCORE-724
> Project: HttpComponents HttpCore
> Issue Type: Bug
> Affects Versions: 5.1.4
> Reporter: Johan Compagner
> Priority: Major
>
> a basic example:
>
>
>
> {code:java}
> public class Main {
> public static void main(String[] args) throws IOException, InterruptedException, ExecutionException, NoSuchAlgorithmException {
> System.err.println(String.join(" ", SSLContext.getDefault().getSupportedSSLParameters().getProtocols()));
> try (CloseableHttpAsyncClient client = HttpAsyncClients.createDefault()) {
> client.start();
> SimpleHttpRequest request1 = SimpleRequestBuilder.get("https://www.google.com/").build();
> Future<SimpleHttpResponse> future = client.execute(request1, null);
> // and wait until response is received
> SimpleHttpResponse response1 = future.get();
> System.out.println(request1.getRequestUri() + "->" + response1.getCode());
> };
> }
> {code}
>
>
> does not work under java 16 or higher
>
> in java 16 you can get around it by using:
> --illegal-access=permit
> but in java 17 that is not allowed anymore, that is ignored.
> if you run it with java 15 you will get:
>
> WARNING: Illegal reflective access by org.apache.hc.core5.util.ReflectionUtils$1 ([file:/C:/workspace_master/HttpTest/lib/httpcore5-5.1.4.jar|file:///C:/workspace_master/HttpTest/lib/httpcore5-5.1.4.jar]) to method sun.security.ssl.SSLEngineImpl.getApplicationProtocol()
>
> and after that line if i enabled wire logging everything goes different, (i think java 16/17 then just try todo http1.1)
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org