最近在進行微信開發,用的碼雲上面比較火的項目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
希望能幫助到你。