如何解决WxMpXmlMessage.fromXml出现NoClassDefFoundError?
发布于 7 年前 作者 taoduan 10079 次浏览 来自 官方Issues

weixin-java-mp-3.3.0和weixin-java-mp-3.6.0都出现接收消息时转换异常:Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class me.chanjar.weixin.mp.util.xml.XStreamTransformer

1 回复

debug 了解一下,你该去github 提 issues。研究一下代码

class XStreamTransformer {

  static int num = 1 / 0;
}

public class Sample {

  public static void main(String[] args) throws InterruptedException {
    Sample sample = new Sample();
    sample.getClassWithInitErrors();
  }

  private void getClassWithInitErrors() throws InterruptedException {
    Thread.sleep(300);
    try {
      new XStreamTransformer();
    } catch (Throwable t) {
      t.printStackTrace();
    }
    Thread.sleep(300);
    try {
      new XStreamTransformer();
    } catch (Throwable t) {
      t.printStackTrace();
    }
    Thread.sleep(300);
    try {
      new XStreamTransformer();
    } catch (Throwable t) {
      t.printStackTrace();
    }
  }

}
回到顶部