cancel
Showing results for 
Search instead for 
Did you mean: 

Error calling IReport.refreshProperties() for publishing reports to BOE12

Former Member
0 Kudos

I am trying to code report publish using Java. I am able to publish them successful, but not able to set data source to the new published reports. I have tried several ways posted in the forum, but there is no luck. Can someone help please?

Here is my part of code to call this method:

oInfoObjectNewReport.setTitle(reportName);

oInfoObjectNewReport.setTitle(reportName);

oInfoObjectNewReport.properties().setProperty(CePropertyID.SI_PARENTID, props.getPublishFolderId());

try{

System.out.println("Refresh properties ...");

/*IReport report = (IReport)oInfoObjects.get(0);

report.getReportRefreshOptions().addOption(IReportRefreshOptions.CeRefreshOption.TITLE);

report.refreshProperties();

report.getReportRefreshOptions().removeOption(IReportRefreshOptions.CeRefreshOption.TITLE);*/

IReport report = (IReport)oInfoObjects.get(0);

IFiles reportFiles = report.getFiles();

IFile rptFile = (IFile) reportFiles.get(0);

rptFile..overwrite(reportLocation);

rptFile.commit();

report.refreshProperties();

}catch(Exception ex){

System.out.println(ex);

}

oInfoStore.commit(oInfoObjects);

Thanks in advance,

Zhang

Accepted Solutions (1)

Accepted Solutions (1)

former_member185028
Active Participant
0 Kudos

Hello.

Can you please put the following code in the catch (SDKException sdkEx) section. Hopefully we will get more information from the stack trace that will be printed to the system.out file. After running that, please capture the errors and stack trace to this thread.

Regards.

- Robert


catch (catch SDKException sdkEx)
{
     out.println("Could not publish report: " + reportName + " obtained from: " + reportFileLocation + "<br>");
     // Set the message to be displayed to the user to indicate that an
     // error has occurred and display the error message.
     out.println("An error was encountered.  A description of the error" + " is as follows:  " + sdkEx.toString());
     // Log the error and the stack trace to the system out log file
     System.out.println("An error was encountered.  A description of the " + "error is written below:");
     System.out.println(sdkEx);
     System.out.println("The stack trace for the error is written below:");
     sdkEx.printStackTrace(System.out);
}

Former Member
0 Kudos

This is the stack trace:

Could not publish report: Quarter obtained from: D:\jazhang\download\BOE120\comverse_reports\Quarter.rpt

An error was encountered. A description of the error is as follows: com.crystaldecisions.sdk.occa.managedreports.reportadd.internal.b: Adding Crystal Report "Quarter.rpt" failed. An internal error occurred.

An error was encountered. A description of the error is written below:

com.crystaldecisions.sdk.occa.managedreports.reportadd.internal.b: Adding Crystal Report "Quarter.rpt" failed. An internal error occurred.

The stack trace for the error is written below:

com.crystaldecisions.sdk.occa.managedreports.reportadd.internal.b: Adding Crystal Report "Quarter.rpt" failed. An internal error occurred.

at com.crystaldecisions.sdk.occa.managedreports.reportadd.internal.d.a(Unknown Source)

at com.crystaldecisions.sdk.occa.managedreports.reportadd.internal.d.refreshReportObjectProperties(Unknown Source)

at com.crystaldecisions.sdk.plugin.desktop.report.internal.m.refreshProperties(Unknown Source)

at com.comverse.businessobjects.PublishComverseReports.publishReport(PublishComverseReports.java:480)

at com.comverse.businessobjects.PublishComverseReports.main(PublishComverseReports.java:132)

Answers (8)

Answers (8)

0 Kudos

For Java 17 and 4.3, SDK is dependent on Log4J (2.17) jar. Please check if it is available in classpath or not.

former_member185028
Active Participant
0 Kudos

Hello James.

So glad that you were able to determine that the problem was likely a classpath issue in your batch script and that you are now able to publish the reports from Eclipse.

For setting up report data source, I would suggest that you open up a new thread for that problem so that more people are able to offer up their suggestions.

Best regards.

- Robert

former_member185028
Active Participant
0 Kudos

Please check the version of the file called cecore.jar in the lib folder of your custom application. You do this by opening the jar file with WinRAR or Winzip and the opening the MAINFEST.MF file in the META-INF folder. There should be a line that states Implementation-Version: 9.9.9.999

If the first number is an 11, then you are using XI R2 jar files for your custom application. If the first number is a 12, then it mean that you are using XI R3 for your custom application. The subsequent numbers refer to the Service Pack, Fix Pack, and Build Version.

Please indicate what the Implementation-Version is of your cecore.jar file.

When you are publishing a Crystal Report to the Enterprise in the CMC, does that Crystal Report already exist at the specified location in the CMC. It is possible that the error may be occurring when trying to refresh the properties when the Crystal Report already exists there. Can you try publishing the Crystal Report and refreshing the properties when the report doesn't already exist in the CMC at the specified folder location.

Regards.

- Robert

Former Member
0 Kudos

This is the informaiton from my cecore.jar file

Manifest-Version: 1.0

Ant-Version: Apache Ant 1.7.0

Created-By: 1.4.2_08-b03 (Sun Microsystems Inc.)

Product-Name: Crystal Enterprise Java SDK (C)

Implementation-Title: Crystal Enterprise SDK core

Build-Time: 07-08-2009:12-29 PM GMT

Build-OS: Windows 2003

Implementation-Version: 12.1.8.1176

Implementation-Vendor: Business Objects, Inc.(C)

I deleted the old folder, and created a new folder, it still gets the same error.

Regards,

James

Former Member
0 Kudos

Hi, Robert:

Very very appreciate your helps.

Now, I can run the script to publish reports successful from Eclipse. So there must have a classpth error in my batch script.

I have the following pieces of code for setting up report data source. Is this the proper way to do it? Seems it needs to setup more than once for each report.

IReportProcessingInfo procInfo = (IReportProcessingInfo) oInfoObjectNewReport;

ISDKList objLogons = procInfo.getReportLogons();

IReportLogon logon = null;

for (int j = 0; j < objLogons.size(); ++j) {

logon = (IReportLogon) objLogons.get(j);

// logon.setCustomDatabaseDLLName("crdb_oracle.dll");

logon.setOriginalDataSource(false);

logon.setSSOEnabled(false);

logon.setCustomServerType(IReportLogon.CeReportServerType.ORACLE);

logon.setCustomUserName("james");

logon.setCustomPassword("password");

logon.setCustomServerName("IP_Address");

logon.setPromptOnDemandViewing(false);

oInfoObjectNewReport.properties().setProperty(CePropertyID.SI_LOGON_INFO, logon);

}

Best regards,

James

former_member185028
Active Participant
0 Kudos

If you RAS Server is up and running without problems and the problem still occurs, another thing that you can check is to make sure that you are using the correct Business Object jar files in your custom application. If you have recently upgraded to an XIR3.1 environment from XIR2, it is possible that the Business Object jar files in your custom application may not have been upgraded. If this is the case that you have upgraded and not updated the Business Object jar files, please make sure that you remove all of the Business Object jar files from the previous version and upgrade them to the current version. The up-to-date SDK jar files can be found in the "Program Files\Business Objects\Common\4.0\java\lib" folder of your Business Objects installation. The Business Object jar files that are necessary can be found in the Enterprise Developer Guide in the section "Setting up the development environment" --> "Web application setup" --> "JAR files needed for deployment of Business Objects Software".

If you don't have the developer guide, it can be found at the following location:

http://help.sap.com/businessobject/product_guides/boexir31/en/boesdk_java_dg_12_en.zip

I hope this helps.

Regards.

- Robert

Former Member
0 Kudos

I have tried the above 2 suggestions. Still get the same error.

The version what I am using is "Crystal Reports Server 2008". This is the version info from CMC -- "Product: 12.1.0 © 2008 Business Objects, an SAP company. All rights reserved."

Where to get the info you mentioned like XIR3.1/XIR2?

Thanks,

James

former_member185028
Active Participant
0 Kudos

What version of the Enterprise product are you using? Please include Major version, service pack version, and fixpack version.

One thing that you need to ensure is that the Report Application Server (RAS) is up and running successfully. There is a blog that was written by Ted Ueda of Business Objects Support that provides some information about refreshing properties when publishing Crystal Reports. Please take a look at the blog at the following link:

/people/ted.ueda/blog/2008/10/20/businessobjects-enterprise-xi-31-java-sdk--reportadd-no-more

I hope that this provides some insight.

Regards.

- Robert

former_member185028
Active Participant
0 Kudos

Code extract continued:


                                                  // Update the system proeprties.
						System.setProperties(properties);    
					
						// Retrieve the PluginMgr object. 
						boPluginMgr = boInfoStore.getPluginMgr();
						
						// Use PluginManager to retrieve the Report plugin, which is needed to publish a new report.
						boPluginInfoNewReport = boPluginMgr.getPluginInfo("CrystalEnterprise.Report");

						// Create a new InfoObjects collection to add the new report to.
						boInfoObjects = boInfoStore.newInfoObjectCollection();

						// Add the newly created report plugin to the boInfoObjects collection. This will create 
						// a new InfoObject based on the type of plugin passed in.
						boInfoObjects.add(boPluginInfoNewReport);
					 
						//Retrieve the newly created report InfoObject
						boInfoObject = (IInfoObject)boInfoObjects.get(0);

						//Set the report name and file location
						boInfoObject.setTitle(reportName);
						boInfoObject.getFiles().addFile(reportFileLocation);

						//Set the parent folder for the new report. 
						boInfoObject.properties().setProperty(CePropertyID.SI_PARENTID, parentID);

						//Refresh the report properties to update the new report information before 
						//committing the changes to the InfoStore
						boReport = (IReport)boInfoObject;
						boReport.refreshProperties();

						//Commit the new collection to the CMS using the commit method. This publishes the new report.
						boInfoStore.commit(boInfoObjects);
						
						// Print a message stating that the report was published.
						out.println("The report has been published successfully.");
					}

					catch (SDKException sdkEx)
					{
						out.println("Could not publish report: " + reportName + " obtained from: " + reportFileLocation + "<br>");
						out.println(sdkEx.getMessage());
					}
				}
				else
				{
					out.println("Report File Location was not entered.<br>");
				}
			}
			else
			{
				out.println("Report Name was not entered.<br>");
			}
		}	
		else
		{
			out.println("Parent Folder ID was not entered.<br>");
		}
	}
	catch (Exception ex)
	{
		// Set the message to be displayed to the user to indicate that an
		// error has occurred and display the error message.
		out.println("An error was encountered.  A description of the error"
				+ " is as follows:  " + ex.toString());
		// Log the error and the stack trace to the system out log file
		System.out.println("An error was encountered.  A description of the "
						+ "error is written below:");
		System.out.println(ex);
		System.out.println("The stack trace for the error is written below:");
		ex.printStackTrace(System.out);
	}
	
	// If the logon was previously successful, then logoff.
	if (boEnterpriseSession != null)
	{
		boEnterpriseSession.logoff();
	}
%>

Former Member
0 Kudos

Hello, Robert:

I've tested the posted code in my environment. Still get error for refreshProperties(). This is the error message:

Could not publish report: Quarter obtained from: C:\jazhang\TEMP\BOE120\comverse_reports\Quarter.rpt

Adding Crystal Report "Quarter.rpt" failed. An internal error occurred.

BTW, The report can be published successful without calling refreshProperties() method. The problem is I have to refresh the report options and configure report data source from CMC manually.

Regards,

James

former_member185028
Active Participant
0 Kudos

Hello.

I am attaching a working jsp sample that publishes a Crystal Report to the CMC. In order to get the sample to run, please enter your login-specific information. Also, please enter the specific parent folder ID where you want the Crystal Report to be published to, enter the specific name that you would like the report in the CMC to be called, and enter the location on disk where the Crystal Report that you want to publish is located.

One thing that you also need to do is to set the Business Objects home directory. In this sample, the home directory has been set to "C:\Program Files\Business Objects".

Please try running the code to confirm that it works for you and then compare it to your code to try to determine why you are having a problem publishing Crystal Reports.

I will post the sample over the next couple of posts because it is too long to be seen clearly on one post.

Regards.

- Robert

Here is the code extract:


<%
/*************************** PublishReport.jsp ******************************** 
 * 
 * This jsp will log the user onto the Enterprise, set the BOBJ_ENTERPRISE_HOME
 * property, create a new InfoObject in a specified parent folder ID, add a
 * file from a specified location, refresh the properties of the report, and
 * commit the changes.
 *
 *****************************************************************************/
%>

<%@ page import = "com.crystaldecisions.sdk.framework.*,
				   com.crystaldecisions.sdk.exception.SDKException,
				   com.crystaldecisions.sdk.occa.infostore.IInfoStore,
				   com.crystaldecisions.sdk.occa.infostore.IInfoObject,
				   com.crystaldecisions.sdk.occa.infostore.IInfoObjects,
				   com.crystaldecisions.sdk.framework.IEnterpriseSession,
				   com.crystaldecisions.sdk.occa.infostore.CePropertyID,
				   com.crystaldecisions.sdk.occa.pluginmgr.IPluginMgr,
				   com.crystaldecisions.sdk.occa.pluginmgr.IPluginInfo,
				   com.crystaldecisions.sdk.plugin.desktop.report.IReport,
				   com.crystaldecisions.sdk.framework.CeEnterpriseContext,
				   java.util.Properties"
%>

<%
	// Declarations
	
	// Business Object Declarations.
	IEnterpriseSession boEnterpriseSession = null;
	ISessionMgr boSessionMgr = null;
	IInfoStore boInfoStore = null;
	IInfoObjects boInfoObjects = null;
	IInfoObject boInfoObject = null;
	IPluginMgr boPluginMgr = null;
	IPluginInfo boPluginInfoNewReport = null;
	IReport boReport = null;
	
	// Logon Information
	String logonUserName = "<Enter Enterprise logon User Name here>";
	String password = "<Enter Password Here>";
	String cmsName = "<Enter CMS Name Here>";
	String authType = "<Enter Authentication Type Here - eg. secEnterprise>";

	// Report and Folder Information.
	
	// Example of a parentFolderID = "12812"
	String parentFolderID = "<Enter the ID of the folder that you want the Crystal Report to be published to>";
	// Example of a reportName = "SimplePreviewReport"
	String reportName = "<Enter the name that you would like for the new report to be called>";
	// Example of a reportFileLocation = "C:\\SimplePreviewReport.rpt"
	String reportFileLocation = "<Enter the location where the report that you would like to publish is located>";
		
	// Try block that will catch an Exception.
	try 
	{			
		// Initialize the Session Manager by getting it from the Crystal Enterprise
		// class's getSessionMgr function.
		boSessionMgr = CrystalEnterprise.getSessionMgr();
		
		// Logon to the Session Manager to create a new BOE session.  Pass in the
		// user name, password, the CMS name, and the authentication
		// type.
		boEnterpriseSession = boSessionMgr.logon(logonUserName, password, cmsName, authType);

	    //Retrieve the InfoStore object
	    boInfoStore = (IInfoStore) boEnterpriseSession.getService("", "InfoStore");
	    
	  	//Check to see if the new report information has been submitted. If it has
		//then publish the new report 
		if (parentFolderID != null)
		{
			if (reportName != null)
			{
				if (reportFileLocation != null)
				{
					//Set the id for the parentFolder
					int parentID = Integer.parseInt(parentFolderID);
					
					try
					{
						// You need to set the CeEnterpriseContext.BOBJ_ENTERPRISE_HOME property first
						// in order to upload new reports because the runtime needs to have access
						// to some utility files located in the Business Object Home directory

						// Modify this to point to your Business Objects installation directory
						String BOBJHome = "C:\\Program Files\\Business Objects";

						// Retrieve the system properties 
						Properties properties = System.getProperties();

						// Set the Business Objects home directory
						properties.setProperty(CeEnterpriseContext.BOBJ_ENTERPRISE_HOME, BOBJHome);

Adam_Stone
Active Contributor
0 Kudos

You say you get an error on calling refreshProperties(), what is it?

Former Member
0 Kudos

Hi, Ted:

This is the exception error message I got. it does not have stack trace.

Refresh properties ...

com.crystaldecisions.sdk.occa.managedreports.reportadd.internal.b: Adding Crystal Report "Quota By Sales Rep By Fiscal Quarter.rpt" failed. An internal error occurred.

Thanks,

James

Adam_Stone
Active Contributor
0 Kudos

Are you able to publish the same report through Infoview, and can you do a refresh properties of the report in the CMC? This should use the same workflow as what your application is doing.

Former Member
0 Kudos

I am able to refresh the report properties from CMC, and able to publish report successful. My current issues is I have to go to CMC to refresh report properties and setup the correct data source.