GVKun编程网logo

JasperReports API:调用JasperCompileManager.compileReport(String)方法引发了MalformedByteSequenceException异常

12

在这篇文章中,我们将带领您了解JasperReportsAPI:调用JasperCompileManager.compileReport的全貌,包括String方法引发了MalformedByteSe

在这篇文章中,我们将带领您了解JasperReports API:调用JasperCompileManager.compileReport的全貌,包括String方法引发了MalformedByteSequenceException异常的相关情况。同时,我们还将为您介绍有关.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列、asp.net – NullReferenceException在PipelineStepManager.ResumeSteps中、Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列、com.google.appengine.api.datastore.PreparedQuery.TooManyResultsException的实例源码的知识,以帮助您更好地理解这个主题。

本文目录一览:

JasperReports API:调用JasperCompileManager.compileReport(String)方法引发了MalformedByteSequenceException异常

JasperReports API:调用JasperCompileManager.compileReport(String)方法引发了MalformedByteSequenceException异常

public void openReport() {    try {        HashMap params = new HashMap();        params.put("aapor", 19);        JasperReport jasperReport1 = JasperCompileManager.compileReport("C:/Users/emidemi.emidemi-PC/Documents/NetBeansProjects/FleetManager/src/FleetManager/newReport5.jasper");        JasperPrint jasperPrint1 = JasperFillManager.fillReport(jasperReport1, params, conn.getConn());        JRViewer viewer = new JRViewer(jasperPrint1);    } catch (Exception e) {        System.out.println(e.getMessage());    }}

以上是我的脚本。

这是我的错误:

com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.BUILD SUCCESSFUL (total time: 7 seconds)

有谁知道这是为什么发生以及如何解决?

答案1

小编典典

字符编码存在问题。您是否尝试过在报告开头更改编码行?

例如,对于中欧字母,请更改:

<?xml version="1.0" encoding="UTF-8"?>

通过

<?xml version="1.0" encoding="CP1250"?>

您在这里有不同字符编码标准的列表:http
:
//en.wikipedia.org/wiki/Character_encoding#Common_character_encodings

希望能奏效

.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列

.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列

OSC 请你来轰趴啦!1028 苏州源创会,一起寻宝 AI 时代

Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列 

 

解决方案:

把出现问题 xml 文件中的 UTF-8 修改为 UTF8 即可且看如下:

image

 

asp.net – NullReferenceException在PipelineStepManager.ResumeSteps中

asp.net – NullReferenceException在PipelineStepManager.ResumeSteps中

由于我将主机更改为ASP.NET 4.0 Web窗体和IIS7集成模式,我的网站通常会出现以下错误:

[NullReferenceException: Object reference not set to an instance of an
object.] System.Web.PipelinestepManager.ResumeSteps(Exception
error) +197
System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext
context,AsyncCallback cb) +89
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr,HttpContext context) +189

但是,网站工作正常.如何解决这个问题?

解决方法

正如Gisli Konrao发表的,在评论中,这是因为您有一个自定义事件处理程序连接在ASP.NET MVC 4应用程序中.

在我的情况下,我有:

this.BeginRequest += new EventHandler(MvcApplication_BeginRequest);

在注释掉这个语句之后,问题就被修复了(ASP.NET将这些事件放在后台,所以只是定义它会使它工作).

Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列

Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列

问题具体描述

D:\tools\java\jdk9\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\tools\javaIDE\IntelliJ IDEA 2021.1\lib\idea_rt.jar=58987:D:\tools\javaIDE\IntelliJ IDEA 2021.1\bin" -Dfile.encoding=UTF-8 -classpath "D:\tools\javaIDE\IntelliJ IDEA 2021.1\lib\idea_rt.jar;D:\tools\javaIDE\IntelliJ IDEA 2021.1\plugins\junit\lib\junit5-rt.jar;D:\tools\javaIDE\IntelliJ IDEA 2021.1\plugins\junit\lib\junit-rt.jar;E:\java\Spring-Student\Spring-10-Mybaties\target\test-classes;E:\java\Spring-Student\Spring-10-Mybaties\target\classes;C:\Users\make\.m2\repository\MysqL\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar;C:\Users\make\.m2\repository\org\mybatis\mybatis\3.5.9\mybatis-3.5.9.jar;C:\Users\make\.m2\repository\org\springframework\spring-jdbc\5.3.15\spring-jdbc-5.3.15.jar;C:\Users\make\.m2\repository\org\springframework\spring-beans\5.3.15\spring-beans-5.3.15.jar;C:\Users\make\.m2\repository\org\springframework\spring-core\5.3.15\spring-core-5.3.15.jar;C:\Users\make\.m2\repository\org\springframework\spring-jcl\5.3.15\spring-jcl-5.3.15.jar;C:\Users\make\.m2\repository\org\springframework\spring-tx\5.3.15\spring-tx-5.3.15.jar;C:\Users\make\.m2\repository\org\aspectj\aspectjweaver\1.9.4\aspectjweaver-1.9.4.jar;C:\Users\make\.m2\repository\org\mybatis\mybatis-spring\2.0.6\mybatis-spring-2.0.6.jar;C:\Users\make\.m2\repository\org\springframework\spring-webmvc\5.3.13\spring-webmvc-5.3.13.jar;C:\Users\make\.m2\repository\org\springframework\spring-aop\5.3.13\spring-aop-5.3.13.jar;C:\Users\make\.m2\repository\org\springframework\spring-context\5.3.13\spring-context-5.3.13.jar;C:\Users\make\.m2\repository\org\springframework\spring-expression\5.3.13\spring-expression-5.3.13.jar;C:\Users\make\.m2\repository\org\springframework\spring-web\5.3.13\spring-web-5.3.13.jar;C:\Users\make\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\make\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\make\.m2\repository\org\projectlombok\lombok\1.18.10\lombok-1.18.10.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 MyTest,test

java.lang.ExceptionInInitializerError
	at MyTest.test(MyTest.java:12)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	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.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error building sqlSession.
### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列的字节 2 无效。
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.sqlSessionFactoryBuilder.build(sqlSessionFactoryBuilder.java:80)
	at org.apache.ibatis.session.sqlSessionFactoryBuilder.build(sqlSessionFactoryBuilder.java:64)
	at com.Google.units.sqlSessionFactory.<clinit>(sqlSessionFactory.java:18)
	... 23 more
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列的字节 2 无效。
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:263)
	at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:127)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:82)
	at org.apache.ibatis.session.sqlSessionFactoryBuilder.build(sqlSessionFactoryBuilder.java:77)
	... 25 more
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列的字节 2 无效。
	at java.xml/com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:702)
	at java.xml/com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:373)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1904)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData(XMLEntityScanner.java:1377)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(XMLScanner.java:800)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(XMLDocumentFragmentScannerImpl.java:1066)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2894)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:601)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:531)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:887)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:823)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:261)
	... 28 more


Process finished with exit code -1

解决方法

image

总结

以上是小编为你收集整理的Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

原文地址:https://www.cnblogs.com/luoking/p/15876935.html

com.google.appengine.api.datastore.PreparedQuery.TooManyResultsException的实例源码

com.google.appengine.api.datastore.PreparedQuery.TooManyResultsException的实例源码

项目:spring-social-showcase-sec-appengine    文件:AppEngineConnectionRepository.java   
@Override
public Connection<?> getConnection(ConnectionKey connectionKey) {
    final CompositeFilter filter = CompositeFilterOperator.and(
        FilterOperator.EQUAL.of("providerId",connectionKey.getProviderId()),FilterOperator.EQUAL.of("providerUserId",connectionKey.getProviderUserId())
    );
    final Query query = new Query(getKind())
        .setAncestor(userKey)
        .setFilter(filter);
    Entity singleEntity;
    try {
        singleEntity = datastore.prepare(query).asSingleEntity();           
    } catch (TooManyResultsException ex) {
        log.warning("Too many results were found for query " + query.toString());
        throw new NoSuchConnectionException(connectionKey);
    }
    if (singleEntity == null) throw new NoSuchConnectionException(connectionKey);
    return connectionMapper.mapEntity(singleEntity);
}
项目:java-docs-samples    文件:QueriesTest.java   
@Test
public void singleRetrievalExample_multitpleEntities_throwsException() throws Exception {
  Entity a = new Entity("Person","a");
  a.setProperty("lastName","Johnson");
  Entity b = new Entity("Person","b");
  b.setProperty("lastName","Johnson");
  datastore.put(ImmutableList.<Entity>of(a,b));

  try {
    Entity result = retrievePersonWithLastName("Johnson");
    fail("Expected TooManyResultsException");
  } catch (TooManyResultsException expected) {
    // TooManyResultsException does not provide addition details.
  }
}
项目:Dendrite    文件:SingleEntity.java   
public DatastoreEntity get() {
    try {
        return new DatastoreEntity(preparedQuery.asSingleEntity());
    } catch (final TooManyResultsException e) {
        System.out.println(e);
        return null;
    }
}

关于JasperReports API:调用JasperCompileManager.compileReportString方法引发了MalformedByteSequenceException异常的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列、asp.net – NullReferenceException在PipelineStepManager.ResumeSteps中、Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列、com.google.appengine.api.datastore.PreparedQuery.TooManyResultsException的实例源码等相关内容,可以在本站寻找。

本文标签: