java做微信开发时报错说HierarchicalStreamDriver类不存在,不知道怎么解决

问题描述

java做微信开发时报错说HierarchicalStreamDriver类不存在,不知道怎么解决

massageUtil.java

  @SuppressWarnings("unchecked")
    public static Map<String, String> parseXml(HttpServletRequest request) throws Exception {
        // 将解析结果存储在HashMap中
        Map<String, String> map = new HashMap<String, String>();  

        // 从request中取得输入流
        InputStream inputStream = request.getInputStream();
        // 读取输入流
        SAXReader reader = new SAXReader();
        Document document = reader.read(inputStream);
        // 得到xml根元素
        Element root = document.getRootElement();
        // 得到根元素的所有子节点
        List<Element> elementList = root.elements();  

        // 遍历所有子节点
        for (Element e : elementList)
            map.put(e.getName(), e.getText());  

        // 释放资源
        inputStream.close();
        inputStream = null;  

        return map;
    }  

报错

  @SuppressWarnings("unchecked")
    public static Map<String, String> parseXml(HttpServletRequest request) throws Exception {
        // 将解析结果存储在HashMap中
        Map<String, String> map = new HashMap<String, String>();  

        // 从request中取得输入流
        InputStream inputStream = request.getInputStream();
        // 读取输入流
        SAXReader reader = new SAXReader();
        Document document = reader.read(inputStream);
        // 得到xml根元素
        Element root = document.getRootElement();
        // 得到根元素的所有子节点
        List<Element> elementList = root.elements();  

        // 遍历所有子节点
        for (Element e : elementList)
            map.put(e.getName(), e.getText());  

        // 释放资源
        inputStream.close();
        inputStream = null;  

        return map;
    }  

包是存在的

求大神帮忙

解决方案

应该将JAR包放在根目录的WEB-INF/lib目录里面

解决方案二:

报错

 六月 03, 2015 6:58:49 下午 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:JDK7.0bin;D:Tomcatbin
六月 03, 2015 6:58:50 下午 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
六月 03, 2015 6:58:50 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 2228 ms
六月 03, 2015 6:58:50 下午 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
六月 03, 2015 6:58:50 下午 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.39
六月 03, 2015 6:58:50 下午 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor host-manager.xml
六月 03, 2015 6:58:51 下午 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
六月 03, 2015 6:58:52 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
六月 03, 2015 6:58:52 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
六月 03, 2015 6:58:52 下午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
六月 03, 2015 6:58:52 下午 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
六月 03, 2015 6:58:52 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
六月 03, 2015 6:58:52 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory Student
六月 03, 2015 6:58:53 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory test
六月 03, 2015 6:58:54 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
六月 03, 2015 6:59:06 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory tt
六月 03, 2015 6:59:06 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory WeChat
六月 03, 2015 6:59:07 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
六月 03, 2015 6:59:18 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory Wechat4j
六月 03, 2015 6:59:18 下午 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
六月 03, 2015 6:59:18 下午 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
六月 03, 2015 6:59:18 下午 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/134  config=null
六月 03, 2015 6:59:18 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 28042 ms
六月 03, 2015 7:01:18 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet WeChatServlet threw exception
java.lang.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriver
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at service.CoreService.processRequest(CoreService.java:31)
    at servlet.WeChatServlet.doPost(WeChatServlet.java:55)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:744)
六月 03, 2015 7:01:27 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet WeChatServlet threw exception
java.lang.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriver
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at service.CoreService.processRequest(CoreService.java:31)
    at servlet.WeChatServlet.doPost(WeChatServlet.java:55)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:744)
六月 03, 2015 7:01:28 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet WeChatServlet threw exception
java.lang.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriver
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at service.CoreService.processRequest(CoreService.java:31)
    at servlet.WeChatServlet.doPost(WeChatServlet.java:55)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:744)

解决方案三:

检查一下是不是版本冲突,换一个版本的jar包试试。祝你成功……

解决方案四:

换一个版本的jar包试试。

解决方案五:

您好,请问您问题解决了么,我也碰到这个问题,求解决

解决方案六:

同求,问题也出现了。怎么解决?

时间: 2024-11-18 10:25:30

java做微信开发时报错说HierarchicalStreamDriver类不存在,不知道怎么解决的相关文章

eclipse连接远程hadoop集群开发时报错

eclipse连接远程hadoop集群开发时报错 Exception in thread "main" org.apache.hadoop.security.AccessControlException: Permission denied: user=d, access=WRITE, inode="data":zxg:supergroup:rwxr-xr-x  at org.apache.hadoop.hdfs.server.namenode.FSPermissi

继承-JAVA 实现接口方法时报错 implement a supertype method

问题描述 JAVA 实现接口方法时报错 implement a supertype method public interface MultimediaControl { public void play(); public void stop(); public void previous(); public void next(); } public class AudioPlayer extends Product implements MultimediaControl { String

php版微信开发Token验证失败或请求URL超时问题的解决方法_php实例

本文实例分析了php版微信开发Token验证失败或请求URL超时问题的解决方法.分享给大家供大家参考,具体如下: 微信开发最近要用到的一个功能,其实就是一个非常的简单的用户输入然后自动搜索数据库并进行一个数据回复了,这个与官方没多大的问题,但小编就微信Token验证失败折腾了许多,下面解决了给各位分析一下. 1.Token验证失败 这个就是要检查配置文件了,最基本的就是 define("TOKEN", "weixin");  weixin 是你的微信开发后台的ID

python使用scapy时报错:no module names pcapy,请问怎么解决?

问题描述 python使用scapy时报错:no module names pcapy,请问怎么解决? 如上图,使用IP的时候说未定义的变量,编译一下就这样,请问怎么解决?我这是在win 8.1下,是不是windows的问题? 解决方案 看样子是没有安装pcapy模块,你根据你的python版本下载了这个包吗 解决方案二: 多说一句,我是从pypi下了包,自己手工运行setup.py安装的,是不是这样的问题

加载mvc项目时,报错,才接触mvc,不知道如何解决

问题描述 加载mvc项目时,报错,才接触mvc,不知道如何解决 加载mvc项目时,报错,才接触mvc,不知道如何解决,报错说是,没有什么model,url等字段 解决方案 什么mvc,spring mvc还是asp.net mvc,什么报错,贴出完整信息. 解决方案二: 是asp.net mvc, 解决方案三: 先ctrl+f5编译下,然后重新打开项目看看.

java web-Struts2返回Json时报错

问题描述 Struts2返回Json时报错 错误信息 : Struts has detected an unhandled exception: Messages: Positioned Update not supported. java.lang.reflect.InvocationTargetException org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetException org.apa

Java的微信开发中使用XML格式和JSON格式数据的示例_java

XML微信XML消息model定义: package cn.wx.server; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.Element; /** * @title cn.wx.serverXMLMsg.java * @todo TODO * @author lpe234 * @time 2014年5月21日下午

求助Java进程被结束时报错

问题描述 在linux下运行pkill-7ID时提示#AfatalerrorhasbeendetectedbytheJavaRuntimeEnvironment:##SIGBUS(0x7)atpc=0xb7f3f402,pid=6008,tid=3086108352##JREversion:6.0_21-b06#JavaVM:JavaHotSpot(TM)ClientVM(17.0-b16mixedmode,sharinglinux-x86)#Problematicframe:#C[+0x402

java调用com串口时报错

问题描述 错误提示:Exceptioninthread"AWT-EventQueue-0"com.jacob.com.ComFailExceprion:acomhasbeenencountered:AtInvokeof:Noah_Connection 解决方案 解决方案二:我是来拿分的解决方案三:http://www.blogjava.net/bcims/archive/2008/03/29/189395.html解决方案四:关注会用到这方面知识