Avatar of mwalker
Flag for United States of America asked on

Accessing a file via HTTPS to JBoss


I'm desperately need to access a file within my Java application via an HttpsURLConnection to a JBoss application server (where the pathName contains "https").  I tried the following code:

            // Establish a connection with the application server to the descriptor file
            URL url = new URL(pathName);
            HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
            conn.setHostnameVerifier(new HostnameVerifier() {
          public boolean verify(String hostname, SSLSession session) {
             // I don't care if the certificate doesn't match host name
             return true;

I get the following exeption:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
      at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA12275)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
      at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
      at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
      at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA12275)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA12275)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA12275)
      at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA12275)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA12275)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(DashoA12275)
      at com.portware.thirdpartylicense.ThirdPartyLicenseClient.fetchFile(ThirdPartyLicenseClient.java:83)
      at com.portware.thirdpartylicense.ThirdPartyLicenseClient.<init>(ThirdPartyLicenseClient.java:53)
      at com.portware.thirdpartylicense.ThirdPartyLicenseClient.getInstance(ThirdPartyLicenseClient.java:30)
      at com.indigo.neuron.gui.HelpMenuMediator$7.run(HelpMenuMediator.java:194)
      at java.lang.Thread.run(Thread.java:534)
Caused by: sun.security.validator.ValidatorException: No trusted certificate found
      at sun.security.validator.SimpleValidator.buildTrustedChain(SimpleValidator.java:304)
      at sun.security.validator.SimpleValidator.engineValidate(SimpleValidator.java:107)
      at sun.security.validator.Validator.validate(Validator.java:202)
      at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(DashoA12275)
      at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(DashoA12275)

Can anyone give me (or point me to) code examples for doing this with JBoss?  Thank you in advance.

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck