Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Execute a java program from a WFT File
sunil_j
I want to execute a java program the moment a Workflow Template (a .wft file) gets loaded, i.e immediately after the workflow .... tag.
Any suggestion will highly be appreciated.
Find more posts tagged with
Comments
Migrateduser
You can call any program, including Java, by using Perl's "system" command, backquotes, or one of several other similar methods.
Consult any Perl manual or documentation such as
http://www.perldoc.com/perl5.005_03/pod/func/system.html
Brinko Kobrin
Interwoven Staff Engineer
sunil_j
I had a java class file named multiparams.class in my
iw-home/iw-perl/bin and I tried using the following code just below the workflow tag in the wft file
`java /iw-home/iw-perl/bin/multiparams`;
But the java programs is not getting executed.
sunil_j
Can u write some code on how to use the backquotes to execute the java program from a WFT File.
I wrote the following code :
`/disk2/home/iw-home/iw-perl/bin/java /disk2/home/iw-home/iw-perl/bin/multiparam`;
But its not getting executed. My Java Class Name is multiparam. I want to execute the above statment the moment my worflow gets instantiated i.e Not as a part of an External Task.
Migrateduser
You need to learn how to run a java program. First see if you can run your program from your command line. Then try to run it from a very simple Perl program (.ipl file). Once you get that far you should be able to just plug your code into a WFT.
Hint: You don't specify the path to your class file.
Brinko Kobrin
Interwoven Staff Engineer
sunil_j
I am able to run the Java program from the command and also through a Perl program test.ipl using the following code
$return_code = system("java multiparam");
But the java program is not getting executed once I plug the same code $return_code = system("java multiparam");
in the WFT. Can you please let me know under which section of the WFT File should I insert the same perl code and the possible reason why the code is not getting executed.
Kindly let me know the details, as it is very urgent.
Johnny
consider who are you running the test script as, compared to the user executing the wft (that will be the web user 'iwui' )
Capture the error from calling the java run time.
You'll find its most likely an environment difference.
Before you shell out to execute the command you will need to set up your environment. Namely the classpath directive.
John
Sydney, Australia
sunil_j
The workflow is being instantiated by root on the Solaris Box.
I am not getting any error while executing the Java Program. The classpath are correctly set.
Johnny
im not talking about the teamsite user invoking the workflow... rather, the user that is running the web daemon.
If this is configured to be root... you have some serious problems to deal with already. By default it is iwui (a minimal privilege user).
When you execute the java program on the command line you are in a different environment.
All you need to do is capture the output, when you try to execute the program. Read the error message. What does it say?
John
Sydney, Australia
Migrateduser
How do you know that the CLASSPATH is being set correctly if you are not specifying it in your command line. Also, are you certain that the 'java' program is in your PATH if you are not specifying the full path?
Brinko Kobrin
Interwoven Staff Engineer
sample.txt
xpath.dcpackage