进入测试号发送消息时,没有回复“您发送的消息是:”,也没有显示服务器异常,控制台报错,映射端post回复200,这是怎么回事

来源:5-4 消息的接收与响应2

qq_慕九州115166

2019-11-13 15:38

十一月 13, 2019 4:55:29 下午 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet [weixinServlet] in context with path [/Weixin] threw exception

java.lang.ClassCastException: org.dom4j.tree.DefaultDocument cannot be cast to org.w3c.dom.Document

at com.imooc.util.MessageUtil.xmlToMap(MessageUtil.java:32)

at com.imooc.servlet.WeixinServlet.doPost(WeixinServlet.java:51)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)

at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:791)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Unknown Source)

http://img4.mukewang.com/5dcbc57f0001500719201080.jpg

http://img.mukewang.com/5dcbc5900001ea4906401136.jpg

写回答 关注

1回答

  • 雷小贱
    2020-05-29 15:58:54

    很明显的类型转换异常,你把DefaultDocument 强行转换成 Document 失败了,报了个类型转换的异常, 你用的那两个类都不是一个包下面的东西

初识Java微信公众号开发

Java微信公众号开发的入门教程,掌握微信公众号基本概念

158330 学习 · 469 问题

查看课程

相似问题