Hmm, I am not so sure that has something to do with the class loader, if
that is the case then problem might be due to each service has its own
class loader and it is different from context class loader. Anyway as I
remember correct no one asked this kind of question before, so if you
find that answer please post that too.
Thanks,
Deepal
artifex wrote:
> That thing didn't work because it couldn't find path to the desired program
> for execution.
> I'm using environment variables in my java code("String envV =
> System.getenv("ENV_VARIABLE");"), but it seems that getenv() cannot find
> the variable. I'm sure it's set up correctly. So now my goal is to find out
> how we can get environmental variables if classes which try to get it are
> inside a web service(???)...
>
> ...if anyone knows please give me a hint...
>
>
> artifex wrote:
>
>> I have deployed a webservice using Axis2. It works fine, but ....
>> Here is a problem: I need to run an external program through the Client,
>> so I've put in existing library piece of code, which contains
>> Runtime.getRuntime(). When I run test, it works fine, but no external
>> program is run. It seems like piece of code with "Runtime rt =
>> Runtime.getRuntime();"(it works when is run locally) just ignored...
>> Could anyone help me with this issue?
>>
>> This is class to be wrapped :
>> package eu.project.samplewebservice;
>>
>>
>>
>> import java.io.BufferedReader;
>>
>> import java.io.InputStream;
>>
>> import java.io.InputStreamReader;
>>
>>
>>
>>
>> public class SampleExistingLibrary {
>>
>>
>>
>> /**
>>
>> * Adds two input integer parameters and returns the result.
>>
>> *
>>
>> * @param i1
>>
>> * An integer input
>>
>> * @param i2
>>
>> * An integer input
>>
>> * @return The integer result which is the sum of the two input
>> integers
>>
>> */
>>
>> public int addTwoIntegers( int i1, int i2 ) {
>>
>> System.out.println( "TEST!!!!!!" );
>>
>> ///!!!!!!!!!!!
>>
>> String mkcolpath = System.getenv("MKCOLPATH");
>>
>> String pafpath = System.getenv("PAFPATH");
>>
>> //System.out.print(mkcolpath);
>>
>> try
>>
>> {
>>
>> Runtime rt = Runtime.getRuntime();
>>
>> Process proc = rt.exec("supertux");
>> //this is a game
>> //pathToCollectionF = pafpath+"/collection.mf";
>>
>> InputStream noerr = proc.getInputStream();
>>
>> InputStream stderr = proc.getErrorStream();
>>
>> InputStreamReader isr = new InputStreamReader(stderr);
>>
>> BufferedReader br = new BufferedReader(isr);
>>
>> InputStreamReader isr1 = new InputStreamReader(noerr);
>>
>> BufferedReader br1 = new BufferedReader(isr1);
>>
>> String line = null;
>>
>> //System.out.println("<OUTPUT>");
>>
>> while ( (line = br1.readLine()) != null || (line =
>> br.readLine()) != null){
>>
>> System.out.println(line);
>>
>> }
>>
>> //System.out.println(line);
>>
>> //System.out.println("</OUTPUT>");
>>
>> int exitVal = proc.waitFor();
>>
>> //exitValCl=exitVal;
>>
>> System.out.println("Process exitValue: " + exitVal);
>>
>> } catch (Throwable t)
>>
>> {
>>
>> t.printStackTrace();
>>
>> }
>>
>>
>>
>>
>>
>> ///!!!!!!!!!!!
>>
>>
>>
>>
>>
>> return i1 + i2;
>>
>>
>>
>> }
>>
>>
>>
>> /**
>>
>> * Concatenates two input string parameters and returns the result.
>>
>> *
>>
>> * @param s1
>>
>> * A string input
>>
>> * @param s2
>>
>> * A string input
>>
>> * @return The string result which consists of two input strings, with
>> the second input string linked to the end of
>>
>> * the first input string
>>
>> */
>>
>> public String concatenateTwoStrings( String s1, String s2 ) {
>>
>> return s1 + s2;
>>
>>
>>
>> }
>>
>> }
>>
>>
>>
>>
>
>
--
Thank you!
http://blogs.deepal.org
http://deepal.org