org.dom4j.DocumentException: null Nested exception: null解决方法
由于最近在学习使用spring架构,经常会遇到与xml文档打交道,今天遇到了此问题,特来分享一下解决方案。
出错原因:
很明显是因为找不到文件路径。这个原因是因为我使用了*.clas.getResourceAsStream(xmlFilePath)来进行xml文档的路径提供。使用这个方法时,对xml文档的路径安放有一定要求,只能在当前路径下进行搜索,不能使用绝对路径和相对路径,所以安放路径不正确就会产生这个异常。
解决方法:
第一种:
将xml文件放到src文件夹下即可。
第二种:
public static Document parse2Document(String xmlFilePath)throws Exception{
SAXReader reader = new SAXReader();
Document document = null;
File f = new File(xmlFilePath);
InputStream in = new FileInputStream();
document = reader(in);
return document;
}
org.dom4j.DocumentException: null Nested exception: null解决方法的更多相关文章
- 记一次接口调试错误: {"timestamp":"2019-09-11T03:04:30.036+0000","status":500,"error":"Internal Server Error","message":"Could not write JSON: Object is null; nested exception is com.fasterxml.jackson
接口测试中用postman测试返回是正常的,但是使用其他人去调用就出错了,找了半天,才想起来使用了nginx,用于端口的代理转发.然后根据错误信息发现json格式的某个字段为null,结合日志中的报文 ...
- org.springframework.dao.InvalidDataAccessApiUsageException: The given id must not be null!; nested exception is java.lang.IllegalArgumentException: The given id must not be null
通过这个简单的案例,手把手教给你分析异常信息(适合初学者看) org.springframework.dao.InvalidDataAccessApiUsageException: The given ...
- org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.
今天报了这个异常,这是页面报的 org.springframework.dao.DataIntegrityViolationException: could not execute statement ...
- WORD 的 Open 和Workbook 的 LoadFromFile 函数返回null的一种解决方法
WORD Application.Documents.Open 和 Workbook workbookExcel.LoadFromFile 函数返回null的一种解决方法 DCOM Config Se ...
- 电脑蓝屏提示unexpected store exception的解决方法
在我们使用电脑的过程中常常会遇到许多问题,对于许多不熟悉电脑的用户常常摸不着头脑,而部分用户在使用电脑时,电脑常常出现蓝屏的情况,并提示你的电脑遇到问题需要重新启动,与此同时,其报告错误代码为“une ...
- VS2010中GetMenu()和GetSubMenu(0)为NULL引发异常的解决方法 及添加方法
对于前面问题的分析:来源于http://blog.163.com/yuyang_tech/blog/static/216050083201211144120401/ 解决方法1: //来源:http: ...
- WORD Application.Documents.Open函数返回null的一种解决方法
DCOM Config Setting for "Microsoft Office Word 97 - 2003 Document" 内部配置一切正常,但调用Application ...
- PHP解码Json(json_decode)字符串返回NULL的原因及解决方法(转载)
本文主要为大家讲解了php在使用json_decode函数解码json字符串时,解码不成功返回NULL的问题原因分析和解决方法,感兴趣的同学参考下. 一般来说,php对json字符串解码使用json_ ...
- null id in entry (don't flush the Session after an exception occurs) 解决方法
最近在学习基于ssh的注解的系统,然后在实现往数据库增加记录时可以增加第一个,第二个就报错,在网上查了很多资料,大多都是 该异常信息是在提示我们没有为数据中的非空字段设置值. 然后就一直没有明白 明明 ...
随机推荐
- ListView 自己定义BaseAdapter实现单选打勾(无漏洞)
(假设须要完整demo,请评论留下邮箱) (眼下源代码已经不发送.假设须要源代码,加qq316701116.不喜勿扰) 近期由于一个项目的原因须要自己定义一个BaseAdapter实现ListVIew ...
- AngularJS 实现 双击排序
关键代码:html <th class="col-md-3"><a href="" ng-click="desc('2',la=!l ...
- python-tornado操作
Tornado 是 FriendFeed 使用的可扩展的非阻塞式 web 服务器及其相关工具的开源版本.这个 Web 框架看起来有些像web.py 或者 Google 的 webapp,不过为了能有效 ...
- adb tcp 调试
su setprop service.adb.tcp.port 5555 stop adbd start adbd
- 04 http协议模拟登陆发帖
<?php require('./http.class.php'); $http = new Http('http://home.verycd.com/cp.php?ac=pm&op=s ...
- 关于TIME_WAIT状态
前言 为何TCP ”四次分手“ 的过程中会有一个TIME_WAIT状态?这个状态有什么意义呢?这是网络中的一个经典问题,本文将给出精简的回答. 什么是TIME_WAIT状态 这是TCP通信协议中出现的 ...
- LeetCode: Binary Tree Postorder Traversal [145]
[题目] Given a binary tree, return the postorder traversal of its nodes' values. For example: Given bi ...
- maven的基本原理和使用
一.Maven中央存储库 当你建立一个 Maven 的项目,Maven 会检查你的 pom.xml 文件,以确定哪些依赖下载.首先,Maven 将从本地资源库获得 Maven 的本地资源库依赖资源,如 ...
- Interface AutoCloseable
https://docs.oracle.com/javase/tutorial/essential/exceptions/try.html https://docs.oracle.com/javase ...
- mac 中安装redis 以及 安装php-redis扩展过程详细记录
1. 通过homebrew 安装 redis sodu brew install redis 2. 安装后执行开启redis,采用默认配置, 默认配置只有本地(127.0.0.1)可以访问.需要远程访 ...