金融其它WebSphere

was 7 下 使用dom4j访问网络资源 无法获得 document对象

在tomcat下 一点问题没有  弄到 websphere下 就无法 得到document对象, 网上搜了好多 真心搞不懂。。。求解
//读取远程XML文件返回Iterator 
public static Iterator loadXmlByUrl(HexunCategory hxCategory) {
Iterator newsList;
SAXReader reader = new SAXReader();
Document doc = null;// 声明文档对象
URL url = null;
try {
System.out.println("读取:"+hxCategory.getCategoryUrl());
url = new java.net.URL(hxCategory.getCategoryUrl());
System.err.println("url:"+url);
doc = reader.read(url);// 读取XML文档
System.out.println("doc:"+doc);
} catch (DocumentException e) {
//如果发生异常则关闭该栏目的更新避免下次更新抛出异常
Manager.updateCategoryState(hxCategory.getCategoryId().toString(), "0");
System.out.println("msg:"+e.getMessage());
e.printStackTrace();
} catch (MalformedURLException e) {
//如果发生异常则关闭该栏目的更新避免下次更新抛出异常
Manager.updateCategoryState(hxCategory.getCategoryId().toString(), "0");
e.printStackTrace();
}
Element newsInfo = doc.getRootElement();// 声明跟元素
newsList = newsInfo.elementIterator("news");
return newsList;
}
[12-7-4 11:26:40:125 CST] 00000012 SystemOut     O 读取:http://news.hexun.com/coopdata/gnjj.xml
[12-7-4 11:26:54:437 CST] 00000012 SystemOut     O msg:news.hexun.com Nested exception: news.hexun.com
[12-7-4 11:26:54:453 CST] 00000012 RequestProces W org.apache.struts.action.RequestProcessor processException Unhandled Exception thrown: class java.lang.NullPointerException
[12-7-4 11:26:54:453 CST] 00000012 servlet       E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: 应用程序 hexun_war 中 servlet action 的某一服务方法创建了未捕获到的异常。创建的异常:javax.servlet.ServletException: java.lang.NullPointerException
at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at com.source.struts.action.MyActionServlet.process(MyActionServlet.java:16)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: java.lang.NullPointerException
at com.source.manager.LoadXml.loadXmlByUrl(LoadXml.java:44)
at com.source.struts.action.ManualLoadXmlAction.execute(ManualLoadXmlAction.java:87)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
... 27 more
[12-7-4 11:26:54:484 CST] 00000012 webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet 错误]-[action]: java.lang.NullPointerException
at com.source.manager.LoadXml.loadXmlByUrl(LoadXml.java:44)
at com.source.struts.action.ManualLoadXmlAction.execute(ManualLoadXmlAction.java:87)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at com.source.struts.action.MyActionServlet.process(MyActionServlet.java:16)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
参与1

0同行回答

“答”则兼济天下,请您为题主分忧!

提问者

晓宝宝的
开发工程师不知道哦

相关问题

问题状态

  • 发布时间:2012-07-04
  • 关注会员:1 人
  • 问题浏览:2573
  • X社区推广