<div dir="ltr">Only thing I could think of was to use reflection to get the actual wrapped factory:<div><br></div><div><a href="https://github.com/hawkular/hawkular-agent/pull/300/commits/bedf8a19496aba56df71c95447b1327c766676d5#diff-394e3f128a0dd5307095aab90861bce7R319">https://github.com/hawkular/hawkular-agent/pull/300/commits/bedf8a19496aba56df71c95447b1327c766676d5#diff-394e3f128a0dd5307095aab90861bce7R319</a><br></div><div><br></div><div>This is currently working on EAP6 (and EAP7).</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 7, 2017 at 4:03 PM, John Mazzitelli <span dir="ltr">&lt;<a href="mailto:mazz@redhat.com" target="_blank">mazz@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">BTW: the latest agent release/master branch will not produce this NPE but it still isn&#39;t good because, instead of getting an NPE, you get this loveliness:<br>
<br>
16:57:53,081 ERROR [org.hawkular.agent.monitor.<wbr>service.MonitorService] (Hawkular WildFly Agent Startup Thread) HAWKMONITOR010054: Agent encountered errors during start up and will be stopped.: java.lang.<wbr>IllegalStateException: Unable to extract the trust manager on okhttp3.internal.platform.<wbr>Platform@69f176ea, sslSocketFactory is class org.jboss.as.domain.<wbr>management.security.<wbr>WrapperSSLContext$WrapperSpi$<wbr>WrapperSSLSocketFactory<br>
        at okhttp3.OkHttpClient$Builder.<wbr>sslSocketFactory(OkHttpClient.<wbr>java:599)<br>
<br>
OKHttp is looking for particular SSL class to find a trust manager but is thrown for a loop when it finds WildFly has its own wrapper implementation. This is the whole reason why this PR exists (and the NPE shows up when running with that PR):<br>
<br>
<a href="https://github.com/hawkular/hawkular-agent/pull/300" rel="noreferrer" target="_blank">https://github.com/hawkular/<wbr>hawkular-agent/pull/300</a><br>
<br>
(and just to clarify, this is only an issue on EAP6.4. Everything works fine on EAP7+)<br>
<div><div class="h5"><br>
----- Original Message -----<br>
&gt; Josejulio, cc hawkular-dev:<br>
&gt;<br>
&gt; &lt;TL;DR&gt;<br>
&gt; Due to incomplete API support in a EAP 6.4 library, we cannot support the<br>
&gt; agent installed as a subsystem extension inside EAP6 if the agent is to talk<br>
&gt; to the Hawkular Server over HTTPS.<br>
&gt; &lt;/TL;DR&gt;<br>
&gt;<br>
&gt; I don&#39;t know how to workaround this one - maybe someone has a bright idea.<br>
&gt; But right now, it looks like we can&#39;t support an EAP6-based agent talking to<br>
&gt; Hawkular-Metrics over HTTPS *unless* the agent is running as a javaagent (a<br>
&gt; new feature not even in master yet, but I tried it and it works).<br>
&gt;<br>
&gt; This is a EAP 6.4 method that OKHttp is calling when making an HTTP request<br>
&gt; requiring SSL - I&#39;ll give you the summary - its a one-line auto-generated<br>
&gt; stub method that &quot;return null;&quot; :)<br>
&gt;<br>
&gt; <a href="https://github.com/wildfly/wildfly-core/blame/de6b17d4d342e98871c0e95f7e6faa9006383768/domain-management/src/main/java/org/jboss/as/domain/management/security/WrapperSSLContext.java#L124-L126" rel="noreferrer" target="_blank">https://github.com/wildfly/<wbr>wildfly-core/blame/<wbr>de6b17d4d342e98871c0e95f7e6faa<wbr>9006383768/domain-management/<wbr>src/main/java/org/jboss/as/<wbr>domain/management/security/<wbr>WrapperSSLContext.java#L124-<wbr>L126</a><br>
&gt;<br>
&gt; I stepped into this code via a debugger and the line number and behavior<br>
&gt; (returning null always) matches up with that code.<br>
&gt;<br>
&gt; Needless to say, this causes a NullPointerException later on in the OKHttp<br>
&gt; library and thus cannot talk to the Hawkular Server over HTTPS.<br>
&gt;<br>
&gt; Here&#39;s the stack trace that got me there:<br>
&gt;<br>
&gt; Daemon Thread [Hawkular WildFly Agent Startup Thread] (Suspended)<br>
&gt;       org.jboss.as.domain.<wbr>management.security.<wbr>WrapperSSLContext$WrapperSpi$<wbr>WrapperSSLSocketFactory.<wbr>createSocket(java.net.Socket,<br>
&gt;       java.lang.String, int, boolean) line: 126<br>
&gt;       okhttp3.internal.connection.<wbr>RealConnection.connectTls(int, int,<br>
&gt;       okhttp3.internal.connection.<wbr>ConnectionSpecSelector) line: 230<br>
&gt;       okhttp3.internal.connection.<wbr>RealConnection.<wbr>establishProtocol(int, int,<br>
&gt;       okhttp3.internal.connection.<wbr>ConnectionSpecSelector) line: 198<br>
&gt;       okhttp3.internal.connection.<wbr>RealConnection.<wbr>buildConnection(int, int, int,<br>
&gt;       okhttp3.internal.connection.<wbr>ConnectionSpecSelector) line: 174<br>
&gt;       okhttp3.internal.connection.<wbr>RealConnection.connect(int, int, int,<br>
&gt;       java.util.List&lt;okhttp3.<wbr>ConnectionSpec&gt;, boolean) line: 114<br>
&gt;       okhttp3.internal.connection.<wbr>StreamAllocation.<wbr>findConnection(int, int, int,<br>
&gt;       boolean) line: 193<br>
&gt;       okhttp3.internal.connection.<wbr>StreamAllocation.<wbr>findHealthyConnection(int, int,<br>
&gt;       int, boolean, boolean) line: 129<br>
&gt;       okhttp3.internal.connection.<wbr>StreamAllocation.newStream(<wbr>okhttp3.OkHttpClient,<br>
&gt;       boolean) line: 98<br>
&gt;       okhttp3.internal.connection.<wbr>ConnectInterceptor.intercept(<wbr>okhttp3.Interceptor$Chain)<br>
&gt;       line: 42<br>
&gt;       okhttp3.internal.http.<wbr>RealInterceptorChain.proceed(<wbr>okhttp3.Request,<br>
&gt;       okhttp3.internal.connection.<wbr>StreamAllocation,<br>
&gt;       okhttp3.internal.http.<wbr>HttpStream, okhttp3.Connection) line: 92<br>
&gt;       okhttp3.internal.http.<wbr>RealInterceptorChain.proceed(<wbr>okhttp3.Request) line: 67<br>
&gt;       okhttp3.internal.cache.<wbr>CacheInterceptor.intercept(<wbr>okhttp3.Interceptor$Chain)<br>
&gt;       line: 109<br>
&gt;       okhttp3.internal.http.<wbr>RealInterceptorChain.proceed(<wbr>okhttp3.Request,<br>
&gt;       okhttp3.internal.connection.<wbr>StreamAllocation,<br>
&gt;       okhttp3.internal.http.<wbr>HttpStream, okhttp3.Connection) line: 92<br>
&gt;       okhttp3.internal.http.<wbr>RealInterceptorChain.proceed(<wbr>okhttp3.Request) line: 67<br>
&gt;       okhttp3.internal.http.<wbr>BridgeInterceptor.intercept(<wbr>okhttp3.Interceptor$Chain)<br>
&gt;       line: 93<br>
&gt;       okhttp3.internal.http.<wbr>RealInterceptorChain.proceed(<wbr>okhttp3.Request,<br>
&gt;       okhttp3.internal.connection.<wbr>StreamAllocation,<br>
&gt;       okhttp3.internal.http.<wbr>HttpStream, okhttp3.Connection) line: 92<br>
&gt;       okhttp3.internal.http.<wbr>RetryAndFollowUpInterceptor.<wbr>intercept(okhttp3.Interceptor$<wbr>Chain)<br>
&gt;       line: 124<br>
&gt;       okhttp3.internal.http.<wbr>RealInterceptorChain.proceed(<wbr>okhttp3.Request,<br>
&gt;       okhttp3.internal.connection.<wbr>StreamAllocation,<br>
&gt;       okhttp3.internal.http.<wbr>HttpStream, okhttp3.Connection) line: 92<br>
&gt;       okhttp3.internal.http.<wbr>RealInterceptorChain.proceed(<wbr>okhttp3.Request) line: 67<br>
&gt;       okhttp3.RealCall.<wbr>getResponseWithInterceptorChai<wbr>n() line: 170<br>
&gt;       okhttp3.RealCall.execute() line: 60<br>
&gt;       org.hawkular.agent.monitor.<wbr>service.MonitorService(org.<wbr>hawkular.agent.monitor.<wbr>service.AgentCoreEngine).<wbr>waitForHawkularServer()<br>
&gt;       line: 648<br>
&gt;       org.hawkular.agent.monitor.<wbr>service.MonitorService(org.<wbr>hawkular.agent.monitor.<wbr>service.AgentCoreEngine).<wbr>startHawkularAgent(org.<wbr>hawkular.agent.monitor.config.<wbr>AgentCoreEngineConfiguration)<br>
&gt;       line: 279<br>
&gt;       org.hawkular.agent.monitor.<wbr>service.MonitorService(org.<wbr>hawkular.agent.monitor.<wbr>service.AgentCoreEngine).<wbr>startHawkularAgent()<br>
&gt;       line: 164<br>
&gt;       org.hawkular.agent.monitor.<wbr>service.MonitorService$<wbr>1CustomPropertyChangeListener$<wbr>1.run()<br>
&gt;       line: 395<br>
&gt;       java.lang.Thread.run() line: 745<br>
&gt;<br>
</div></div>______________________________<wbr>_________________<br>
hawkular-dev mailing list<br>
<a href="mailto:hawkular-dev@lists.jboss.org">hawkular-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/hawkular-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/hawkular-dev</a><br>
</blockquote></div><br></div>