【解決】Could not initialize class me.chanjar.weixin.mp.util.xml.XStreamTransformer和java.lang.NoSuchMethodError: com.thoughtworks.xstream.XStream.setupDefault問題


 

最近在進行微信開發,用的碼雲上面比較火的項目WxJava (https://gitee.com/binary/weixin-java-tools

在基礎上進行二次開發,但是在接收微信接受公眾號消息的時候報錯:

Could not initialize class me.chanjar.weixin.mp.util.xml.XStreamTransformer  

 

 

查找資料:發現少了xstream依賴

只需要在pom.xml里引用依賴

<dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>1.4.10</version>
</dependency>

 

注意:Xstream版本要用 1.4.10,試了其他幾個版本,會報錯沒有 setupDefault方法

java.lang.NoSuchMethodError: com.thoughtworks.xstream.XStream.setupDefault

 

希望能幫助到你。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM