java.lang.RuntimeException: org.dom4j.DocumentException: 1 字节的 UTF-8 序列的字节 1 无效。

向一个XML文件写入出现异常

解决办法:使用记事本打开该XML文件,另存为,编码选择UTF-8

java.lang.RuntimeException: org.dom4j.DocumentException: 1 字节的 UTF-8 序列的字节 1 无效。
at cn.itcast.user.dao.UserDao.add(UserDao.java:65)
at test.dao.UserDaoTest.testAdd(UserDaoTest.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.dom4j.DocumentException: 1 字节的 UTF-8 序列的字节 1 无效。
at org.dom4j.io.SAXReader.read(SAXReader.java:468)
at org.dom4j.io.SAXReader.read(SAXReader.java:307)
at cn.itcast.user.dao.UserDao.add(UserDao.java:44)
... 24 more
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:687)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:557)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1735)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanLiteral(XMLEntityScanner.java:1059)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:835)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:439)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:255)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
at org.dom4j.io.SAXReader.read(SAXReader.java:449)
... 26 more

原文地址:https://www.cnblogs.com/denggelin/p/9221200.html

时间: 2024-10-28 21:04:03

java.lang.RuntimeException: org.dom4j.DocumentException: 1 字节的 UTF-8 序列的字节 1 无效。的相关文章

Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException

1.错误描述 信息: Initializing c3p0-0.9.2.1 [built 20-March-2013 10:47:27 +0000; debug? true; trace: 10] 2014-7-12 19:18:48 org.springframework.web.context.ContextLoader initWebApplicationContext 严重: Context initialization failed org.springframework.beans.f

Caused by java lang ClassNotFoundException org dom4j Docum

1.错误描述 信息: Initializing c3p0-0.9.2.1 [built 20-March-2013 10:47:27 +0000; debug? true; trace: 10] 2014-7-12 19:18:48 org.springframework.web.context.ContextLoader initWebApplicationContext 严重: Context initialization failed org.springframework.beans.f

解决Android studio 启动报错java.lang.RuntimeException: java.lang.IllegalArgumentException

报错内容 Internal error. Please report to https://code.google.com/p/android/issues java.lang.RuntimeException: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'name' of com/android/tools/idea/welcome/Platform.<init> must not be null 

真机测试报错ERROR/AndroidRuntime: java.lang.RuntimeException: setParameters failed解决办法

这个错误是和调用相机摄像头相关的. 产生这个错误的原因主要在于代码控制分辨率的显示和真机测试分辨率不一样. 一:解决办法 WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Camera.Parameters parameters = camera.getParameters();// 得到摄像头的参数 para

resin WED服务器初用遇到的问题和解决方法 java.lang.RuntimeException: java.net.SocketException: Unrecognized Windows Socke ts error: 0: JVM_Bind

开启resin 服务器以后提示如下:(控制台不断的循环循环打印如下错误提示) java.lang.RuntimeException: java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind at com.caucho.server.cluster.Server.start(Server.java:1191) at com.caucho.server.cluster.Cluster.startServer(

严重: Dispatcher initialization failed java.lang.RuntimeException: java.lang.reflect.InvocationT

严重: Dispatcher initialization failed java.lang.RuntimeException: java.lang.reflect.InvocationT (2012-09-23 17:20:13) 转载▼ 标签: struts中jar包 dispatcherinitializa 分类: Struts2 错误提示:严重: Dispatcher initialization failed java.lang.RuntimeException: java.lang.

Android Studio 首次安装报错 Java.lang.RuntimeException:java.lang.NullPointerException...错

下次安装报:Java.lang.RuntimeException: java.lang.NullPointerException......错 只需在文件..\Android Studio\bin\idea.properties(需要对应自己的安装目录下)最后面加一行代码:disable.android.first.run=true  就可以完美解决问题了

uiatuomator提示shortMsg=java.lang.RuntimeException

自动化要做断言,原本打算使用的testng,因为它断言后就能出结果,还能生成报告,但是在实践过程中,硬是没有成功,所以还是放弃,使用的junit,后面使用的cts框架生成的邮件,现在记录使用junit遇到的坑 1.在调试junit时提示shortMsg=java.lang.RuntimeException 出现这样的问题解决方法 1.项目clear,关闭项目在重新开启 2.前面已经运行了一个应用程序还没有结束,导致后面不能运行 先查出uiatuomator的进程,在杀掉进程, adb shell

hive 报错 java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:344) at org.a