cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing a file in a jar

Shabarish_Nair
Active Contributor
0 Kudos

Hi All,

I have a program (java mapping) in which i want to access some values from a file. Hence i have the file as part of my imported archive (jar)

But seems in PI, it doesn't recognize the file.

Ex.

my jar file contains

myprogram.java

myprogram.class

myfile.txt

and myfile.txt is being refereed by the program (it works in standalone) but in PI it fails to find the file

Any comments? I am on PI 7.1 EHP1

Note: I can place the file on the PI server directory and refer it in my program but I dont want to do so and want to make the file as part of the imported archive only.

~~ Shabz

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Though it is technically feasible (using ResourceBundle APIs or equivalent), SAP strongly recommends not to access files from within mappings (could create perf/handler/etc issues) ... Or if you can't prevent it, you have to make sure it won't affect system stability especially during heavy load periods (some sort of custom caching mechanism through a static map ?)

Rgds

Chris

Shabarish_Nair
Active Contributor
0 Kudos

its a XML validation using an XSD. so i need to have the XSD that has to be referred by the parser.

The damn thing works when i place the file on the server but it doesn't work if i import it as part of the jar. That sucks !!!

Former Member
0 Kudos

Could you not import the XSD as external definition into PI and then use std XMLvalidation features in PI ? Are you on 7.1 ?

CSY

Shabarish_Nair
Active Contributor
0 Kudos

Yes I am on PI 7.1, but my requirement cannot be met by the standard validation feature available. So i need to customize them a bit and hence the java mapping

Answers (3)

Answers (3)

Shabarish_Nair
Active Contributor
0 Kudos

Seems the best way would be to place the files on the server.

Former Member
0 Kudos

What things are you reading from this file ?

CSY

former_member181985
Active Contributor
0 Kudos

check my reply @ [|]

Shabarish_Nair
Active Contributor
0 Kudos

Doesnt help.

The URL entry always returns null