HTMLUnit and Java: NoSuchMethodException: createDefaultSSLContext()

ε祈祈猫儿з 提交于 2019-12-25 16:47:23

问题


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


回答1:


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.




回答2:


I had the same problem when using HtmlUnit 2.12. I upgraded to 2.15 and it solved the problem.




回答3:


   java.lang.NoSuchMethodException: org.apache.http.conn.ssl.SSLSocketFactory.createDefaultSSLContext()

It is not JVM issue, It seems you have wrong version of apache jar in classpath at runtime. Make sure you have correct version of HttpClient jar at runtime.



来源:https://stackoverflow.com/questions/17556397/htmlunit-and-java-nosuchmethodexception-createdefaultsslcontext

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!