例外:

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表示您调用的方法引发了异常。为了弄清楚方法本身的问题,您可以尝试在可移植的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);


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

09-30 16:59