gpt4 book ai didi

java - 碧 Jade 报告 : filling a report throws an exception “TargetInvocationException”

转载 作者:行者123 更新时间:2023-11-29 03:24:28 32 4
gpt4 key购买 nike

异常:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.reflect.InvocationTargetException
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)

代码:

 PreparedStatement ps = conn.prepareCall("{ call StoreProcedureDemo(?) }");
ps.setString(1,condition);

ResultSet rs = ps.executeQuery();

// System.out.println("Inside ordersheetReport");
HashMap jasperParameter = new HashMap();
JasperReport jasperReport;
JasperPrint jasperPrint = null;

try
{
File file = new File(Paths.FTPPath+"PDF/"+name+".pdf");
file.delete();

}catch (Exception e) {
// TODO: handle exception
}
System.out.println("1");
JRResultSetDataSource rsss = new JRResultSetDataSource(rs);
System.out.println("2");
jasperReport = JasperCompileManager.compileReport(Paths.FTPPath+"JRXML/OrderSheet.jrxml");
System.out.println(" jasperReport "+Paths.FTPPath+"JRXML/OrderSheet.jrxml");
//JasperFillManager.fillReportToFile("D:/reports/test.jasper", jasperParameter, rsss);
try{
System.out.println("try 3.1.");
jasperPrint = JasperFillManager.fillReport(jasperReport,jasperParameter, rsss);
System.out.println("try 3.2.");
}catch (JRException e) {
System.out.println("catch 3..");
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
//JasperPrintManager.printReport(jasperPrint,true);

JasperExportManager.exportReportToPdfFile(jasperPrint, Paths.FTPPath+"PDF/"+name+".pdf");

}catch(JRException e)
{
// System.out.println("precriptionReport : "+e);
e.printStackTrace();
}

我能够在 System.out.println("try 3.1."); 之前获取日志。

最佳答案

InovcationTargetException 表示您调用的方法抛出异常。要弄清楚您的方法本身有什么问题,您可以尝试在 cought Throwable 上使用 getCause()。而不是直接编译jrxml文件.compileReport(Paths.FTPPath+"JRXML/OrderSheet.jrxml")

首先尝试使用 jasper 加载器:

JasperDesign design = JRXmlLoader.load(Paths.FTPPath+"JRXML/OrderSheet.jrxml");
JasperReport report = JasperCompileManager.compileReport(design);

否则,问题可能源于连接,(我可以从您的代码中看到准备好的语句,但看不到连接详细信息)。

关于java - 碧 Jade 报告 : filling a report throws an exception “TargetInvocationException” ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21777874/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com