问题描述
- 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