我正在尝试自动发布PDF格式的Crystal报告。我使用IDE:IntelliJ Gradle
public void runApprovedSupplierSiteReport(){
// final Config config = ConfigFactory.instance(Config.class);
//CrystalUtil.setupJdbcJndi(Config.getDatabaseServer(), Config.getDatabaseUsername(), Config.getDatabasePassword(), Config.getDatabaseJdbcDriver(), Config.getDatabaseJdbcUrl());
final List<String> paramNames = Config.getMatches(APPROVED_SUPPLIER_SITE_PARAM_REGEX);
final Map<String, String> params = new HashMap<>();
for (final String name : paramNames) {
final String value = Config.getPqp_Report_ApprovedSupplierSite_Param_$0_Value(name);
params.put(name, value);
}
final ReportClientDocument reportDoc = new ReportClientDocument();
try {
// export PDF
final String report = Config.getPqp_Report_ApprovedSupplierSite_Rpt();
reportDoc.open(report, OpenReportOptions._openAsReadOnly);
CrystalUtil.setParamFields(reportDoc, params);
final InputStream is = reportDoc.getPrintOutputController().export(ReportExportFormat.PDF);
//
final Session session = CmisUtil.createSession(Config.getPdmsAtomPubUrl(), Config.getPdmsUser(), Config.getPdmsPassword(), Config.getPdmsRepositoryId());
final Map<String, Object> properties = DocumentManager.getDocumentProperties(
DocType.SUPPLIER_REPORTS,
DocGroup.MQPSD,
SUPPLIER_REPORT_DOC_NUMBER,
SUPPLIER_REPORT_NAME,
new Date());
final String prefix = ConfigUtil.getEnvironmentPrefix(Config.getTwsEnvironmentCode());
final String docName = prefix + String.format(DocFormat.SUPPLIER_REPORTS, PdmsUtil.getDateAsString(new Date()));
final Document document = CmisUtil.createDocument(
session,
docName + ".pdf",
"",
docName,
DocClass.REPORTS,
MediaType.PDF.toString(),
is,
-1,
properties);
Monitor.getLogger().info("<- PDMS report=" + report + " id=" + document.getId() + " versionSeriesId=" + document.getVersionSeriesId());
} catch (final ReportSDKException e) {
String err = e.getMessage();
Monitor.getLogger().error("runApprovedSupplierSiteReport() " + e.getMessage());
logger.error("runApprovedSupplierSiteReport()", e);
} catch (final CmisBaseException e) {
Monitor.getLogger().error("runApprovedSupplierSiteReport() " + e.getErrorContent());
logger.error("runApprovedSupplierSiteReport()", e);
} finally {
CrystalUtil.closeQuietly(reportDoc);
}
}
字符串
在上面的代码片段中,在reportDoc.open(report, OpenReportOptions._openAsReadOnly);
行,我得到了以下错误:
java.lang.AbstractMethodError: com.businessobjects.reports.sdk.JRCCommunicationAdapter.setProductLocale(Ljava/util/Locale;)V
at com.crystaldecisions.proxy.remoteagent.z.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.int(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initialize(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ClientDocument.new(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.new(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ClientDocument.open(Unknown Source)
at com.crystaldecisions.reports.sdk.ReportClientDocument.open(SourceFile:80)
at com.processstream.pepsico.pqp.tws.ows.PqpOwsJob.runApprovedSupplierSiteReport(PqpOwsJob.java:264)
at com.processstream.pepsico.pqp.tws.ows.PqpOwsJobTest.runApprovedSupplierSiteReport_1(PqpOwsJobTest.java:36)
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:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
型
我已经检查了所有的抽象类,但所有的方法都是定义的。如果有人能帮助我解决这个错误,请告诉我。
1条答案
按热度按时间acruukt91#
字符串
此方法在用于编译代码的库版本中是具体的,因此IDE很乐意编译对它的调用引用。
部署位置中存在的库是一个不同的版本,其中此方法是抽象的。
这在
AbstractMethodError
的Javadoc中有描述:当应用程序试图调用抽象方法时抛出。通常,此错误由编译器捕获;此错误仅在运行时发生,如果自上次编译当前执行的方法以来,某个类的定义发生了不兼容的更改。