2 u011394890 u011394890 于 2015.06.03 22:39 提问

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;  
    }  

包是存在的
图片说明

求大神帮忙

8个回答

Louissisi
Louissisi   2016.01.10 20:13

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

u011394890
u011394890   2015.06.03 22:42

报错

 六月 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.0\bin;D:\Tomcat\bin
六月 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)

Haydroid
Haydroid   2015.06.04 10:04

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

u011394890
u011394890 原来是因为在工程的发布目录下的WEB-INF\lib下面没有这些jar包
2 年多之前 回复
datou431
datou431   Rxr 2015.06.18 10:59

换一个版本的jar包试试。

tanlingfang
tanlingfang   2015.09.28 09:20

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

qq_34425222
qq_34425222   2016.03.29 10:13

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

malayoutiao
malayoutiao   2017.02.17 15:47

一样的问题,有xstream的包,还是报这个xstream下的io.HierarchicalStreamDriver 找不到

malayoutiao
malayoutiao   2017.02.17 16:08

解决了。我之间把包放在一个文件夹里,再放进lib导致读不到。直接放lib下就不报错了

Csdn user default icon
上传中...
上传图片
插入图片