I have following code on my Apache Tika Maven project.

This code works when I test locally, but fails when it's attached as
external jar in Apache Solr (container is Tomcat).

String cmd; contains command string that will convert file with input as

./convert.bin input.custom output.xml

I checked that convert.bin and input.custom exists.


String cmd; // As explained above
File out = new File(dir_path, output.xml); // dir_path is file path

Process ps = null;

try {
    ps = Runtime.getRuntime().exec(cmd); // execute command
    int exitVal = ps.waitFor();
    logger.info("Executing Runtime successful with exit value of " +
exitVal); 
    // exitVal is 0
} catch (Exception e) {
    logger.error("Exception in executing Runtime: " + e); // not reaching
here
}

// I get "Out file does not exist", although I should get the proper output   
if (out.exists()) logger.info("Out file exists]");
else logger.info("Out file does not exist]"); // reaches here

out.setWritable(true);
out.setReadable(true);
out.setExecutable(true);
out.deleteOnExit();

// I get FileNotFoundException here
InputStream xml_stream = new FileInputStream(out);


I'm really confused because I get the right result locally (Maven test), but
not when it is on Tomcat.

Any help please?



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Runtime-exec-not-working-on-Tomcat-tp4002614.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to