根據 [1] 的解答,問題是發生在我用 Maven 引入了新版的 httpclient 4.5.1,但是沒有指定 httpcore 的版本
所以 Maven 自動用了比較舊版的 httpcore 4.3.x,導致了找不到需要的類別的問題。
我的 Maven 內容如下:
1 2 3 4 5 |
< dependency > < groupId >org.apache.httpcomponents</ groupId > < artifactId >httpclient</ artifactId > < version >4.5.1</ version > </ dependency > |
修正成以下的樣子就可以了。
1 2 3 4 5 6 7 8 9 10 |
< dependency > < groupId >org.apache.httpcomponents</ groupId > < artifactId >httpclient</ artifactId > < version >4.5.1</ version > </ dependency > < dependency > < groupId >org.apache.httpcomponents</ groupId > < artifactId >httpcore</ artifactId > < version >4.4.1</ version > </ dependency > |
參考資料:
沒有留言:
張貼留言