cancel
Showing results for 
Search instead for 
Did you mean: 

File LookUp in the MM : FileNotFound Exception

Former Member
0 Kudos

Hello Friends,

I am trying to fetch a file during the message mapping. The code I have written in the UDF is as follows :

<u>

String company = "";

HashMap fileMap = new HashMap();

BufferedReader reader = new BufferedReader(new FileReader("C:
testfolder
Mydata.txt"));

String line = "";

while((line = reader.readLine())!=null)

{

String[] lineArray = line.split(",");

fileMap.put(lineArray[1], lineArray[0]);

}

company = (String) fileMap.get(a);

return company; </u>

<b>

But I am getting the FileNotFound Exception when I tried to run the interface mapping.

I have confirmed that file is there in the respective folder.

1. Can we use the above code to fetch the file ?

2. Do we need to put the file in the XI server ?

</b>

Thanks for your time.

~PRANAV

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

and what exactly you are trying to do with this code ?

to access files,you need to use Java io api's,and you can access file from any server,not just XI server

but there are few drawbacks with this,first of all the file name and path will be hardcoded so u need to change it every time you move your file from Dev to QA to Prd.

secondly this approach is good to read the file,but not a very good idea to write something in the file

Thanx

Aamir

Former Member
0 Kudos

a

prateek
Active Contributor
0 Kudos

1. Havent tried it but seems possible

2. It should be on the XI server.

Regards,

Prateek

Former Member
0 Kudos

Hi Pranav,

where is the path located ? on XI Server?

Ranjeet Singh.

Former Member
0 Kudos

Hi Pranav,

File need to be on XI server. .

Ranjeet Singh,.