You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (Jira)" <ji...@apache.org> on 2022/08/23 20:03:00 UTC

[jira] [Resolved] (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 ]

Oleg Kalnichevski resolved HTTPCORE-724.
----------------------------------------
    Resolution: Invalid

[~jcompanger@gmail.com] Please either upgrade to 5.2 that no longer makes use of reflective access to get ALPN protocol details or use 5.1 APIs as described here [1] to get ALPN details without use of the reflective access.

Oleg

[1] https://github.com/apache/httpcomponents-client/blob/5.1.x/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java

> 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