最近在进行微信开发,用的码云上面比较火的项目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
希望能帮助到你。