cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Run SAP Crystal Reports on JBoss

Former Member
0 Kudos

Hi Folks,

I'm trying to run SAP Crystal Reports using eclipse JAVA code on JBoss EAP Server, and I'm unable to run reports. Getting following error.

com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: com.crystaldecisions.jakarta.rpoifs.RandomAccessPOIFileSystem.B()Lcom/crystaldecisions/jakarta/poi/poifs/filesystem/DirectoryEntry;---- Error code:-2147467259 Error code name:failed

Unfortunately, I couldn't find much help related to this online. The same code, I'm able to run on a Tomcat 7 Server without any issues. When I deploy the same WAR file in JBoss, the deployment seems to be successful. But when I call the respective .jsp file, which in turn calls the .rpt file and throws the above error.

I have added all the necessary SAP Business Objects and Crystal Report runtime jar files in my lib folder. Below is my sample JSP code. Appreciate your help in assisting to resolve this issue.

Also attached the list of library files I'm referring in my eclipse.

Thanks.

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1" %>

<%@ page import="com.businessobjects.samples.CRJavaHelper,

com.crystaldecisions.report.web.viewer.CrystalReportViewer,

com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,

com.crystaldecisions.sdk.occa.report.application.ReportClientDocument,

com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,

java.sql.Connection,

java.sql.DriverManager,

java.sql.ResultSet,

java.sql.SQLException,

java.sql.Statement,

java.lang.Object"

%>

<%

  // This sample code calls methods from the CRJavaHelper class, which

  // contains examples of how to use the BusinessObjects APIs. You are free to

  // modify and distribute the source code contained in the CRJavaHelper class.

  try {

  //String reportName = "C:/Users/kschandra/workspace/CrystalRpt/WebContent/CrystalReport2.rpt";

  String reportName = "C:/Users/kschandra/jboss-eap-6.3.0.Alpha/jboss-eap-6.3/standalone/deployments/CrystalRpt.war/CrystalReport2.rpt";

  ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);

  if (clientDoc == null) {

  // Report can be opened from the relative location specified in the CRConfig.xml, or the report location

  // tag can be removed to open the reports as Java resources or using an absolute path

  // (absolute path not recommended for Web applications).

  clientDoc = new ReportClientDocument();

  clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);

  // Open report

  clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);

  // ****** BEGIN POPULATE WITH RESULTSET SNIPPET **************** 

  {

  // **** POPULATE MAIN REPORT ****

  {

  // Connection Info for fetching the resultSet

  String connectStr = "jdbc:oracle:thin:@IP Address";

  String driverName = "oracle.jdbc.OracleDriver";

  String userName = ""; // TODO: Fill in database user

  String password = ""; // TODO: Fill in valid password

  // TODO: Ensure this query is valid in your database. An exception will be thrown otherwise.

  String query = "";

  // As long the Resultset schema has the same field names and types,

  // then the Resultset can be used as the datasource for the table

  String tableAlias = "VW_SETTLEMENT_DATA"; // TODO: Change to correct table alias

  // Push the Java ResultSet into the report (this will then be the datasource of the report)

  CRJavaHelper.passResultSet(clientDoc, fetchResultSet(driverName, connectStr, userName, password, query),

  tableAlias, "");

  }

  }

  // ****** END POPULATE WITH RESULTSET SNIPPET ****************

  // ****** BEGIN POPULATE WITH POJO SNIPPET **************** 

  {

      // This option is not applicable for the report you have chosen

  }

  // ****** END POPULATE WITH POJO SNIPPET ****************

  // Store the report document in session

  session.setAttribute(reportName, clientDoc);

  }

  // ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET **************** 

  {

  // Create the CrystalReportViewer object

  CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();

  String reportSourceSessionKey = reportName+"ReportSource";

  Object reportSource = session.getAttribute(reportSourceSessionKey);

  if (reportSource == null)

  {

  reportSource = clientDoc.getReportSource();

  session.setAttribute(reportSourceSessionKey, reportSource);

  }

  // set the reportsource property of the viewer

  crystalReportPageViewer.setReportSource(reportSource);

  // Apply the viewer preference attributes

  // Process the report

  crystalReportPageViewer.processHttpRequest(request, response, application, null);

  }

  // ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************

  } catch (ReportSDKExceptionBase e) {

     out.println(e);

  } catch (SQLException e) {

        out.println(e);

    }

%><%!

// Simple utility function for obtaining result sets that will be pushed into the report. 

// This is just standard querying of a Java result set and does NOT involve any

// Crystal Reports Java SDK functions.

  private static ResultSet fetchResultSet(String driverName,

  String connectStr, String userName, String password, String query) throws SQLException, ClassNotFoundException {

  //Load JDBC driver for the database that will be queried

  Class.forName(driverName);

  Connection connection = DriverManager.getConnection(connectStr, userName, password);

  Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

  //Execute query and return result sets

  return statement.executeQuery(query);

}%>

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Prithviraj,

Thanks for your reply. I resolved this issue. Seems like on of my jar file was conflicting with the crystal report in JBOSS. After removing servlet-api.jar file from my project, it started working.

Thanks,

Regards,

Chandramouli

Former Member
0 Kudos

Great that your issue is resolved, you could have also set the precedence instead of deleting a jar from your application.

Please mark the thread as answered for your solution so that it might help others.

Thanks,

Prithvi

Former Member
0 Kudos

Hi Chandramouli,

From the code snippet above, it seems you are using the Crystal Reports for ecllipse runtimes to run your unmanaged reports.

You would want to post your questions to the below forum, which is a space maintained for Crystal Reports For Ecllipse queries.

http://scn.sap.com/community/crystal-reports-for-eclipse

Additionally, the issue looks to be class conflict issue in jboss. Make sure that you give precedence to your applications jars over the web application server jar files.

Thanks,

Prithvi

Former Member
0 Kudos

Hi,

Can you please provide the Bo Version with patches (if any) and also the version of jboss you are using

Thanks,

Prithvi