Search code examples
javatomcatjbossjvm

How to ignore SSL Certificate Java


I keep getting this exception "javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names matching IP address xxx.xxx.xx.xxx found" on a http get request. I've tried pretty much everything already. Is there a JVM argument that i can use to ignore SSL certificates?

These are the VM arguments running on my JBOSS.

"-Dprogram.name=JBossTools: Red Hat JBoss EAP 6.1+" -server -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000


Solution

  • Have you tried to use this class?

    Add it to your project and then make a static call.

     static {
            SSLUtilities.trustAllHostnames();
            SSLUtilities.trustAllHttpsCertificates();
        }