Skip to Content
0
Former Member
Jun 03, 2008 at 06:30 PM

Location of a File in KM folder

68 Views

Hi Gurus,

I need to read an excel file from a KM repository using POI API. I have been able to read it when it is bundled with the PAR, but this time I have to read if from one of the KM folders.

Following is the code that Im using.


public void readfile(){
		  
	String repository_km;
	
	System.err.println(" called fn2");
	  try{
	  System.err.println("inside try");
	  repository_km = "/Folder1/SB/Book3.xls";
	  RID rid=RID.getRID(repository_km);
	  System.err.println("printing rid " + aRid);
	  IPortalComponentRequest componentRequest = (IPortalComponentRequest) this.getRequest();
							
	  String FileURL = componentRequest.getPublicResourcePath() + rid;
				
	  System.err.println("Ahoy : - " + FileURL);

	  InputStream fs = new FileInputStream(FileURL);
			
	  HSSFWorkbook wb = new HSSFWorkbook(fs);
	  System.err.println("created workbook");
				
                   .............................................logic for reading file using POI API.........

When I run this code, It gives me the following error :

#1.5 #00E0ED0BA5EF00870000001E00001E8C00044EC6F7ED3FF2#1212516376854#System.err#sap.com/irj#System.err#BHARDWS#8114##n/a##4e1928b0319611dd9fbc00e0ed0ba5ef#Thread[PRT-Async 3,5,PRT-Async]##0#0#Error##Plain###called fn2#
#1.5 #00E0ED0BA5EF00870000001F00001E8C00044EC6F7ED40A2#1212516376854#System.err#sap.com/irj#System.err#BHARDWS#8114##n/a##4e1928b0319611dd9fbc00e0ed0ba5ef#Thread[PRT-Async 3,5,PRT-Async]##0#0#Error##Plain###inside try#
#1.5 #00E0ED0BA5EF00870000002000001E8C00044EC6F7ED41FE#1212516376855#System.err#sap.com/irj#System.err#BHARDWS#8114##n/a##4e1928b0319611dd9fbc00e0ed0ba5ef#Thread[PRT-Async 3,5,PRT-Async]##0#0#Error##Plain###Ahoy : - /usr/sap/PSA/JC40/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/portalapps/File_Upload_Utility//Folder1/SB/Book3.xls#
#1.5 #00E0ED0BA5EF00870000002100001E8C00044EC6F7ED448C#1212516376855#System.err#sap.com/irj#System.err#BHARDWS#8114##n/a##4e1928b0319611dd9fbc00e0ed0ba5ef#Thread[PRT-Async 3,5,PRT-Async]##0#0#Error##Plain###FileNotFoundException Occured java.io.FileNotFoundException: /usr/sap/PSA/JC40/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/portalapps/File_Upload_Utility/Folder1/SB/Book3.xls (No such file or directory)FileuploadUtility - Code is rendered: Tue Jun 03 13:06:16 CDT 2008#

The error is a "FileNotFoundException" and the path I think is incorrect. This is the path that it is picking up:

/usr/sap/PSA/JC40/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/portalapps/File_Upload_Utility/Folder1/SB/Book3.xls

My file is stored under "/Folder1/SB/" and the filename is -->Book3.xls

I tried to put this in the browser and it says "the requested resource does not exist"

What am I missing. Please suggest.

Edited by: S.B on Jun 3, 2008 8:32 PM