I have a jar (that I can't change) that I would like to call after a successful file transfer in IBM MQ File Transfer Edition (FTE). I'm using MQ FTE 7.0.4. I've set commandPath
in agent.properties
to include the path to the java executable and the path to the jar I want to run. The most common error I get is:
The agent's command path '/opt/IBM/WMQFTE/jre/bin:/path/to/jar/postTask.jar' does not define a path to this command. Only commands whose path is on the agent's command path can be run.
When I set the post transfer command to be: /opt/IBM/WMQFTE/jre/bin/java
with no parameters, I get no errors other than the java executable complaining that it didn't get any parameters. When I run: /opt/IBM/WMQFTE/jre/bin/java -jar /path/to/jar/postTask.jar ${FilePath}
, I get an error like the one above.
Why is it that I can run/call Java all by itself but when I attempt to include parameters, it fails?
Things I haven't tried yet: 1) writing a small batch script that executes the java call that I want. 2) Opening a PMR with IBM.
Other research:
This very helpful question explained the difference between Calls and Exits. Exits require implementing the MonitorExit
interface which I can't do in my case.
This question may also belong on Super User; I'm not sure.
I have attempted to recreate your problem but I can successfully run a Java program (packaged as a Jar file) using a post source program call; which is what I believe you are trying to do. As such, I think your problem is likely to be a configuration issue.
With the information you have provided, you should set the "commandPath" property in your agent's agent.properties file like so:
commandPath=/opt/IBM/WMQFTE/jre/bin
The change should then be followed by a restart of your agent so that the change is picked up.
You can then test that your Java program is invoked successfully using the fteCreateTransfer command; to execute a runnable Jar file as a post source program call, use the following option on the command:
-postsrc "executable:/opt/IBM/WMQFTE/jre/bin/java(-jar,/path/to/jar/postTask.jar,),,,0"
(The syntax is described in the FTE Infocenter: http://pic.dhe.ibm.com/infocenter/wmqfte/v7r0/topic/com.ibm.wmqfte.doc/start_new_transfer_cmd.htm)
Now, from your question I assume you are using a resource monitor (by the mention of ${FilePath}), so you will need to configure your transfer template XML used by the resource monitor correctly. Such as:
...
<transferSet priority="0">
<postSourceCall>
<command name="/opt/IBM/WMQFTE/jre/bin/java" retryCount="0" retryWait="0" successRC="0" type="executable">
<argument>-jar</argument>
<argument>/path/to/jar/postTask.jar</argument>
<argument>${FilePath}</argument>
</command>
</postSourceCall>
<item checksumMethod="MD5" mode="binary">
...
Note that the three arguments are split into separate elements.
Can you make sure your system is configured like I have described above and give it another try to see if it resolves your problem?
Thanks!