![](/img/trans.png)
[英]java.lang.NoSuchMethodError: >org.xhtmlrenderer.layout.SharedContext: method <init>()V not found
[英]java.lang.NoSuchMethodError: org.apache.http.protocol.BasicHttpContext: method <init>()V not found
嗨,我想提出一個小的webapp,但我遇到了錯誤。 以下是我的代碼
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("SomeURL"); // Using a URL local to my machine
// after setting nameValuePair and setting it on httppost
httppost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
// This is where I am getting the above mentioned exception
HttpResponse response = httpclient.execute(httppost);
我使用的是httpclient-4.0-beta2.jar和httpcore-4.0.1.jar。 看起來BasicHttpContext與我的應用程序中的其他一些罐子發生了沖突,但我無法弄明白。 任何線索將不勝感激。
看起來你有一個帶有舊版/新版BasicHttpContext
的jar文件。 如果存在直接沖突,則會收到ClassNotFoundException
。 ClassLoader通常是關於這種事情的混蛋。 在這種情況下,該類存在但是沒有另一個庫(我相信它是調用Context
的httpclient)被編譯的方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.