Skip to Content
0
Former Member
Feb 18, 2009 at 11:16 AM

not able to open a webi document in java

49 Views

final String CMS = "pundl10492:6400";
		final String userID = "administrator";
		final String password = "";
		final String auth = "secEnterprise";
		
		
		IEnterpriseSession enterpriseSession = null;
		try
		{
			ISessionMgr mySessionMgr = CrystalEnterprise.getSessionMgr();
			
			enterpriseSession = mySessionMgr.logon(userID, password, CMS,auth);
			System.out.println("Session created : "+ enterpriseSession.toString());
			
			if (enterpriseSession != null)
			{
				IInfoStore iStore = (IInfoStore)enterpriseSession.getService("InfoStore");
				ReportEngine reportEngine = (ReportEngine)enterpriseSession.getService("WebiReportEngine");
				final String query = "SELECT SI_ID, SI_NAME FROM CI_INFOOBJECTS WHERE SI_KIND = 'Webi' " +
										"and SI_NAME like '%Least Accessed Documents%'";
				IInfoObjects objInfoObjectsWIDs = (IInfoObjects) iStore.query(query);
				IInfoObject objInfoObjectWID = (IInfoObject) objInfoObjectsWIDs.get(0);
				int docId = objInfoObjectWID.getID();
				System.out.println("docID : "+docId);
				DocumentInstance doc = reportEngine.openDocument(docId);
				
				FileOutputStream l_fos= null;
				String fileName = "morcom" + "_" + userID+ "."+"xls";
				l_fos = new FileOutputStream("D:\\_workarea\\MORCOM_POC\\reports\\"+fileName);
				BinaryView docBinaryView = (BinaryView)doc.getView(OutputFormatType.XLS);
				byte[] b = docBinaryView.getContent();
				l_fos.write(b);
				
				System.out.println("File created");
			}
			
		}
		catch(Exception e)
		{
			e.printStackTrace();
		} 

I am trying to open a document and the code iam using is given above. I am using BO XIR3 and i get

Exception in thread "main" java.lang.NoClassDefFoundError: com/crystaldecisions/celib/trace/h

at com.businessobjects.sdk.plugin.desktop.webi.internal.d.<clinit>(Unknown Source)

at com.businessobjects.sdk.plugin.desktop.webi.internal.WebiFactory.makePlugin(Unknown Source)

at com.crystaldecisions.sdk.occa.pluginmgr.internal.PluginMgr.getPluginInterface(PluginMgr.java:291)

at com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects.continueUnpack(InfoObjects.java:409)

at com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects.startUnpack(InfoObjects.java:361)

at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore.queryHelper(InternalInfoStore.java:712)

at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore.query(InternalInfoStore.java:566)

at com.crystaldecisions.sdk.occa.infostore.internal.InfoStore.query(InfoStore.java:167)

at BOTest.main(BOTest.java:42)

error at this line:-

IInfoObjects objInfoObjectsWIDs = (IInfoObjects) iStore.query(query);

Can anyone give a code snippet for opening a webi document in release3. The same code works in release 2.

Thanks

Shruti