cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with to run program operating system command

Former Member
0 Kudos

Hello everybody,

I have a scenario XI adapter - to - File adapter (using SAP PI 7.0 installed in AIX version 5.3) The File Adapter is the receiver. I'm using the option Run Operating System Command After Message Processing for execute a program made in Java (java /<path>/<path_program>/Program (Program is type *.class))

The parameters the Adapter File are:

Transport Protocol: File System (NFS)

Message Protoco: File

Adapter Engine: Integration Server

In Processing tab, the parameters are:

Processing Parameters

File Construction Mode: Create

Overwrite Existing File (checked)

Write Mode: Directly

File Type: Binary

Run Operating System Command After Message Processing

Command Line: java /usr/folder/share/test/Program

(Program is a java program with class extension).

When the Adapter is Actived the channel monitor show me

Status: Success

Description: Execute OS command "java /usr/folder/share/test/Program"

(The java program realized a Math operations and write them in a File created in the same program)

The problem is that never I to see the file that java program should created.

Note: java version "1.4.2"

I hope that you can help me.

Thank you in advance.

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Esteben Vera,

Fisrt of all, Thank you for stating your problem so clearly. Seldom I see such clear explanation of a problem in Forum. This proves you are very clear in expressing, what you want.

Now coming to your problem here are few suggestions

1. Did you test running your java code directly within PI server, i.e without using the feature in communication channel?

2. If the answer to above question is yes, then were you able to see the file created as expected in PI server?

3. If answer to above question is yes. Then there should be no reason that file is not being created, except for the problem that maybe the java code is unable to create the new file because it does not have necessary permissions to create a file in the directory.

4. if answer to question 2 is no, Then forum members need to go thorugh the code to suggest changes if necessary.

regards

Anupam

Former Member
0 Kudos

Hi, Anupam

Thank you for you answer/questions

Well....

1. Did you test running your java code directly within PI server, i.e without using the feature in communication channel?

Answer 1. Yes

2. If the answer to above question is yes, then were you able to see the file created as expected in PI server?

Answer 2. Yes

3. If answer to above question is yes. Then there should be no reason that file is not being created, except for the problem that maybe the java code is unable to create the new file because it does not have necessary permissions to create a file in the directory.

Answer 3. I don't understand, if I executed the program directly within PI Server and the program create the files without problem ¿why not from Integration Directory (Configuration of File Adapter)? ¿Who does to execute the command configured in the section Run Command? ¿User SAP PI?

Thanks you.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Esteban,Experts,


My scenario is file to file PI 7.31 SP11 and I am using only ID objects no ESR objects but the challenge is encryption using java binary file(.jar) file.When I requested for public key they replied saying "We will provide the encryption utility in the form of java binary file(.jar) file."

The receiver system needs the file to be encrypted by using jar file rather than public key.


Thanks,

Nithin.





Former Member
0 Kudos

closed

aashish_sinha
Active Contributor
0 Kudos

Hi,

As per my experience on this, you cannot call a java class in RUN OS Command.

To make it work, you have to write one shell script in AIX system. In this shell script you have to include all environment variables and then use the command at the end of the file and try to execute the shell script there. If it is success then you can try to include that shell script and check.

But in my case it din't worked out. So what I did as an alternative approach is I created an external operating system command in SM49 and linked my shell script with that. Then i created an event in SM36/37. The events work is to execute the external OS command created in SM49.

Now to run this event, we have created a Shell script which calls the event and in response it runs External OS command (ie first shell script with java command). This shell script should be given as command in Run OS command after processing. So whenever the adapter get called, events will execute and our actual shell script will run Java Class.

To run a java class, this is the process we found. A bit lengthy, but we have to use this approach.

Regards

Aashish Sinha

Former Member
0 Kudos

Hi Aashish Sinha, thank you for you answer.

Of course I created a shell script:


#!/bin/sh
rm logs/*.log
java  Program

The shell script is in the same route that is de Program Java. So in the section Run Operating System Command After Message Proccesing I tried:


/usr/temp/test.sh

NOTE: the shell script file has a permission for execute.

Regards

ERVA