0

I am using org.jsoup:jsoup:1.12.1:

Document doc = Jsoup.connect("https://example.com").get()

When I had tried JAVA: 8.0.232-open, 9.0.4-open, 11.0.5-open I received

       javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching <domain> found.

exception.

Project is using Grails4 and it's not building with JAVA > 12, cause in case JAVA13+ it throws:

1 error (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.) org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: General error during semantic analysis: Unsupported class file major version 57

java.lang.IllegalArgumentException: Unsupported class file major version 57

From what I have found it's issue with JAVA itself, not with jsoup: JSoup javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching <url> found

I have tried Gradle: 3.5.1 and 6.1-rc-2 but without success.

How to resolve it?

Michal_Szulc
  • 4,097
  • 6
  • 32
  • 59
  • Is this a request against a public site with proplery working https setup? Have you tried with some other means to fetch the site content? – cfrick Jan 13 '20 at 10:58
  • It's a request against company's website, but we have tested the code also against public websites. https is working fine at all of them but code is not working. Problem is with handling ssl via JAVA. have you checked the referenced link? – Michal_Szulc Jan 13 '20 at 11:43
  • I have and I find it very suspicious especially since the other OP mentions it's occurring at random and their solution is a killswitch for a security feature. – cfrick Jan 13 '20 at 11:47
  • Other OP mentioned that the bug was fixed in JAVA 13, but Grails4 webapp is not building with JAVA13. Have you got any substantive hint? – Michal_Szulc Jan 13 '20 at 12:16
  • The error indicates (if you search outside the jsoup context), that your "example.com" is configured to another CN. So the usual solution is to a) use the proper name or b) add the cert from your target to the truststore. E.g. https://stackoverflow.com/a/36483016/3181392 – cfrick Jan 13 '20 at 12:24
  • 2
    Regarding your second question - spring-boot 2.1 which Grails 4.0 is based on only supports java 11. Grails 4.1 (unreleased) will be based on sb 2.2 which will support up to java 13. – erichelgeson Jan 13 '20 at 15:25

0 Answers0