例外:
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。”);.
答案 0 :(得分:2)
InovcationTargetException意味着您调用的方法引发了异常。要弄清楚你的方法本身有什么问题,你可以尝试在cought Throwable上使用getCause()。
而不是直接编译jrxml文件。compileReport(Paths.FTPPath+"JRXML/OrderSheet.jrxml")
首先尝试使用jasper loader:
JasperDesign design = JRXmlLoader.load(Paths.FTPPath+"JRXML/OrderSheet.jrxml");
JasperReport report = JasperCompileManager.compileReport(design);
否则,问题可能来自连接,(我可以从您的代码中看到准备好的语句,但不能看到连接细节)。
答案 1 :(得分:2)
这里有tomcat jar和应用程序jar的问题。(可能与jar文件冲突).. 我已经将我的tomcat服务器格式从6改为8版本,这对我来说很好..
感谢你们所有的时间..