Search code examples
javahtmlunit

HTMLUnit and Java: NoSuchMethodException: createDefaultSSLContext()


I have this HTMLUnit project and every time I try to build it it gives the following error: Exception in thread "main" java.lang.RuntimeException: java.lang.NoSuchMethodException: org.apache.http.conn.ssl.SSLSocketFactory.createDefaultSSLContext(). I tried to search for a solution but the proposed approaches don't look right to me. The JVM I'm using is Java SE 6 (MacOS X Default) and even changing the compiler level from 1.6 to 1.7 or 1.5 doesn't solve the problem. I'm 100% sure the program runs on other machines, but I can't access their JVM to check. Do any idea on how to solve the issue?

Thanks a lot


Solution

  • Apparently the problem was neither in the JVM nor in the Apache jar at runtime. I downloaded a more recent version of HTMLUnit and this seemed to fix the problem. Hopefully if somebody has or had had the same problem, this can fix it.