Hi,
I'm evaluating CR and I'm trying to integrate it into my Spring MVC application but I'm running into an issue while trying to publish the project. I imported all the JARs I've downloaded from SAP while following the "set parameters" example found on this page Crystal Reports Java SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki
I'm using Eclipse Luna with Maven. My pom.xml is pointing locally. In addition, I've created a test report using Eclipse Helios (don't want to try to get the designer to work with Luna yet) with a simple query. When I configure my controller to output a pdf I get the following errors during publish.
Error on publish
Jun 15, 2015 1:54:51 PM org.apache.catalina.core.ApplicationContext log
INFO: Spring WebApplicationInitializers detected on classpath: [gov.nih.nhlbi.trac.config.MvcInitializer@b0eed09, gov.nih.nhlbi.trac.config.SecurityWebApplicationInitializer@6bb3cddc]
Jun 15, 2015 1:54:51 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Jun 15, 2015 1:55:01 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: com/crystaldecisions/sdk/occa/report/lib/ReportSDKException
My controller looks like this..
@RequestMapping(value = "myReport", params = "submit", method = RequestMethod.POST) | |||
public void getMyReport(HttpServletRequest request, | |||
HttpServletResponse response | |||
) throws IOException, ReportSDKException { | |||
String reportPath; | |||
ReportClientDocument reportClientDocument; | |||
ParameterFieldController parameterFieldController; | |||
ByteArrayInputStream byteArrayInputStream; | |||
byte[] byteArray; | |||
int bytesRead; | |||
reportPath = request.getParameter("report_path"); | |||
reportClientDocument = new ReportClientDocument(); | |||
reportClientDocument.setReportAppServer(ReportClientDocument.inprocConnectionString); | |||
reportClientDocument.open(reportPath, OpenReportOptions._openAsReadOnly); | |||
parameterFieldController = reportClientDocument.getDataDefController() | |||
.getParameterFieldController(); | |||
parameterFieldController.setCurrentValue("", "submitter", "BUTLERROB"); | |||
byteArrayInputStream = (ByteArrayInputStream) reportClientDocument | |||
.getPrintOutputController().export(ReportExportFormat.PDF); |
response.reset(); |
response.setHeader("Content-disposition", "inline;filename=crreport.pdf"); | ||
response.setContentType("application/pdf"); |
byteArray = new byte[1024]; | ||||
while((bytesRead = byteArrayInputStream.read(byteArray)) != -1) { | ||||
response.getOutputStream().write(byteArray, 0, bytesRead); | ||||
} |
response.getOutputStream().flush(); | ||
response.getOutputStream().close(); |
reportClientDocument.close(); | ||
} |
My pom.xml file looks like this:
<dependency> | |||
<groupId>com.sap.crystalReports</groupId> | |||
<artifactId>CrystalReportRuntime</artifactId> |
<version>1.0.0-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\CrystalReportsRuntime.jar</systemPath> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.sap.crystalReports</groupId> | |||
<artifactId>webreporting</artifactId> |
<version>1.0.0-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\webreporting.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>com.sap.crystalReports</groupId> | |||
<artifactId>CrystalCommon2</artifactId> |
<version>1.0.0-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\CrystalCommon2.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>com.azalea.ufl.barcode</groupId> | |||
<artifactId>barcode</artifactId> |
<version>1.0-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\com.azalea.ufl.barcode.1.0.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>commons-configuration</groupId> | |||
<artifactId>commons-configuration</artifactId> |
<version>1.2-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\commons-configuration-1.2.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>cvom</groupId> | |||
<artifactId>cvom</artifactId> |
<version>1.4.2-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\cvom.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>DatabaseConnectors</groupId> | |||
<artifactId>DatabaseConnectors</artifactId> |
<version>1.5.0-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\DatabaseConnectors.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>icu4j</groupId> | |||
<artifactId>icu4j</artifactId> |
<version>4.2.1-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\icu4j.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>jai_imageio</groupId> | |||
<artifactId>jai_imageio</artifactId> |
<version>1.4.2-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\jai_imageio.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>JDBInterface</groupId> | |||
<artifactId>JDBInterface</artifactId> |
<version>1.5.0-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\JDBInterface.jar</systemPath> | |||
</dependency> | |||
<dependency> | |||
<groupId>jrcerom</groupId> | |||
<artifactId>jrcerom</artifactId> |
<version>1.5.0-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\jrcerom.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>keycodeDecoder</groupId> | |||
<artifactId>keycodeDecoder</artifactId> |
<version>1.5.0-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\keycodeDecoder.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>logging</groupId> | |||
<artifactId>logging</artifactId> |
<version>1.4.2-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\logging.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>pfjgraphics</groupId> | |||
<artifactId>pfjgraphics</artifactId> |
<version>1.5.0-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\pfjgraphics.jar</systemPath> | |||
</dependency> |
<dependency> | |||
<groupId>QueryBuilder</groupId> | |||
<artifactId>QueryBuilder</artifactId> |
<version>1.5.0-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\QueryBuilder.jar</systemPath> | |||
</dependency> |
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
<version>1.1.3.4-RT</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\xpp3.jar</systemPath> |
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>system</scope> | |||
<systemPath>${lib.path}\lib\log4j.jar</systemPath> |
</dependency>
UPDATE: solved.. this issue was resolved by adding the correct JARs to my web deployment assembly configuration.