[Solved] Execute command Alf 34d
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2011 06:31 AM
Hello,
A custom action launch some commands on the system (transformation picture, detection of barcode). All was working great on Alfresco 32r2, 3.3g on Windows and Linux but I try to use it on 3.4d Linux RHEL and I get problems… (all is ok with 34d on Windows).
In my code
Error execution stdInput
Error execution stdError
With another command
Error execution stdError
The same command is working great on the server…
Are there something change to use Runtime.getRuntime().exec with the 3.4d ? Perhaps new version of Tomcat…
Thank you
(on french forum : http://forums.alfresco.com/fr/viewtopic.php?f=11&t=4798&start=0#p21898)
A custom action launch some commands on the system (transformation picture, detection of barcode). All was working great on Alfresco 32r2, 3.3g on Windows and Linux but I try to use it on 3.4d Linux RHEL and I get problems… (all is ok with 34d on Windows).
In my code
…Process proc = Runtime.getRuntime().exec(commands);…‍‍‍
Content of the variables commands[/bin/sh, -c, convert -density 125 -threshold 46% "/opt/Alfresco/tomcat/temp/Alfresco/ReadBarcodesSplit1499126559/1_splitted.pdf" +adjoin "/opt/Alfresco/tomcat/temp/Alfresco/ReadBarcodesSplit1499126559/1_splitted.pdf_B.gif"]‍‍
Error execution stdInput
Error: /invalidfont in /findfontOperand stack: –dict:6/6(L)– F10 8 –dict:9/9(L)– –dict:9/9(L)– TimesNewRomanPSMT –dict:9/9(L)– Times-Roman Times-RomanExecution stack: %interp_exit .runexec2 –nostringval– –nostringval– –nostringval– 2 %stopped_push –nostringval– –nostringval– –nostringval– false 1 %stopped_push 1797 1 3 %oparray_pop 1796 1 3 %oparray_pop 1792 1 3 %oparray_pop –nostringval– –nostringval– 2 1 1 –nostringval– %for_pos_int_continue –nostringval– –nostringval– –nostringval– –nostringval– %array_continue –nostringval– false 1 %stopped_push –nostringval– %loop_continue –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– –nostringval– 1767 9 9 %oparray_popDictionary stack: –dict:1086/1123(ro)(G)– –dict:2/20(G)– –dict:74/200(L)– –dict:74/200(L)– –dict:105/127(ro)(G)– –dict:259/300(ro)(G)– –dict:21/25(L)– –dict:4/6(L)– –dict:24/31(L)–Current allocation mode is localLast OS error: 2‍‍
Error execution stdError
GPL Ghostscript 8.56: Unrecoverable error, exit code 1.convert.bin: Postscript delegate failed `/opt/Alfresco/tomcat/temp/Alfresco/ReadBarcodesSplit1453127511/1_splitted.pdf': No such file or directory @ pdf.c/ReadPDFImage/612..convert.bin: missing an image filename `/opt/Alfresco/tomcat/temp/Alfresco/ReadBarcodesSplit1453127511/1_splitted.pdf_A.gif' @ convert.c/ConvertImageCommand/2775.39000‍‍‍‍‍
With another command
[/bin/sh, -c, /usr/local/bin/zbarimg -q -Sdis -Sqrcode.en "/opt/Alfresco/tomcat/temp/Alfresco/ReadBarcodesSplit45676289/0_splitted.pdf_A.gif"]‍
Error execution stdError
zbarimg: magick/cache.c:647: AcquireOnePixelFromCache: Assertion `image != (Image *) ((void *)0)' failed.‍
The same command is working great on the server…
Are there something change to use Runtime.getRuntime().exec with the 3.4d ? Perhaps new version of Tomcat…
Thank you
(on french forum : http://forums.alfresco.com/fr/viewtopic.php?f=11&t=4798&start=0#p21898)
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2011 06:54 AM
I have done other tests. If I execute on the server or from a Java software, all is ok. I think the problem come from Tomcat.
Command on the server : OK
Java Software (compile and execute with Java Alfresco) : OK
Action in Alfresco : Error
Any ideas ?
Command on the server : OK
[root@ged1 runexec]#/usr/bin/convert /media/lienVersPartage/test/runexec/im.pdf /media/lienVersPartage/test/runexec/im.pdf.gif‍‍
Java Software (compile and execute with Java Alfresco) : OK
import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.File;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;import java.io.InputStreamReader;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.Date;import java.util.Random;import java.util.concurrent.locks.Condition;import java.util.concurrent.locks.Lock;class Run {public final static String OS_NAME = System.getProperty("os.name");public final static String LINUX = "linux";public final static String WINDOWS = "windows"; public static void main (String[] args){ System.out.println("Start…"); String command = "/usr/bin/convert /media/lienVersPartage/test/runexec/im.pdf /media/lienVersPartage/test/runexec/im.pdf.gif"; executeCommand(command,true,false); }public static boolean executeCommand(String command, boolean waitFor, boolean disableDirectOutputError) { BufferedReader stdInput = null; BufferedReader stdError = null; boolean returnSuccess = true; try { String[] commands = new String[3]; // Depending of the OS if ((OS_NAME.toLowerCase()).indexOf("windows") >= 0) { // Windows commands[0] = "cmd.exe"; commands[1] = "/C"; } else if ((OS_NAME.toLowerCase()).indexOf("linux") >= 0) { // Linux commands[0] = "/bin/sh"; commands[1] = "-c"; // Les programmes sont dans /usr/local/bin/ //commands[2]="/usr/local/bin/"; } else { System.out.println("Not configurate to run external commands on : " + OS_NAME); return false; } // Add the command to execute commands[2] = command; String infoMessage = ""; for (String cmd : commands) { infoMessage += cmd + ";"; } System.out.println("Run the external commands : '" + infoMessage + "' and waitFor : " + waitFor); Process proc = Runtime.getRuntime().exec(commands); stdInput = new BufferedReader(new InputStreamReader( proc.getInputStream())); stdError = new BufferedReader(new InputStreamReader( proc.getErrorStream())); // Wait if (waitFor) { System.out.println("Wait for…"); proc.waitFor(); System.out.println("End of external process"); } // // Outputs // String outputLine = null; String output = ""; String outputError = ""; while ((outputLine = stdInput.readLine()) != null) { output += outputLine; } // Output error while ((outputLine = stdError.readLine()) != null) { outputError += outputLine; } // Write outputs if (output != null && output.length() > 0) { System.out.println(output); //if (outputMessage != null) { // outputMessage.message = output; //} } if (outputError != null && outputError.length() > 0) { if (!disableDirectOutputError) { System.out.println(outputError); } //if (outputMessage != null) { // outputMessage.messageError = output; //} returnSuccess = false; } } catch (Exception e) { System.out.println("Error trying using the external command"); return false; } finally { // Close try { if (stdInput != null) { stdInput.close(); } } catch (Exception e) { System.out.println("Error trying closing flux"); returnSuccess = false; } try { if (stdError != null) { stdError.close(); } } catch (Exception e) { System.out.println("Error trying closing flux"); returnSuccess = false; } } return returnSuccess; }}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
Action in Alfresco : Error
commands[2]="/usr/bin/convert /media/lienVersPartage/test/runexec/im.pdf /media/lienVersPartage/test/runexec/im.pdf.gif";…Process proc = Runtime.getRuntime().exec(commands);…‍‍‍‍‍‍
Info erreur (stdError)sh: -c: line 0: syntax error near unexpected token `&'sh: -c: line 0: `"gs" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=/tmp/magick-XXk5sZ0E" "-f/tmp/magick-XXND5eN3" "-f/tmp/magick-XXmbSlAs"'convert: Postscript delegate failed `/media/lienVersPartage/test/runexec/im.pdf': No such file or directory.convert: missing an image filename `/media/lienVersPartage/test/runexec/im.pdf.gif'.‍‍‍
Any ideas ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2011 03:08 AM
The code which was working in 33g doesn't work in 34d. I thought a problem with tomcat 33g-> 6.0.18 and 34d->6.0.26.
I have replace the directory /opt/Alfresco/tomcat/conf from the 34d with 33g but there always the problem.
Where can be the difference using "Runtime.getRuntime().exec" between the 33g and 34d with Linux?
Thank you.
I have replace the directory /opt/Alfresco/tomcat/conf from the 34d with 33g but there always the problem.
Where can be the difference using "Runtime.getRuntime().exec" between the 33g and 34d with Linux?
Thank you.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2011 03:50 AM
I have created an issue : http://issues.alfresco.com/jira/browse/ALF-7920
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2011 07:58 AM
All is ok now…
Run the Alfresco convert from the Server
ImageMagick need some variables… Write in the command line
Run the Alfresco convert from Alfresco
If your code start convert. Just set the variables
Run the Alfresco convert from the Server
ImageMagick need some variables… Write in the command line
export MAGICK_HOME=/opt/Alfresco/common export DYLD_LIBRARY_PATH=/opt/Alfresco/common/libexport LD_LIBRARY_PATH=/opt/Alfresco/common/libconvert …‍‍‍‍‍‍
Run the Alfresco convert from Alfresco
If your code start convert. Just set the variables
String[] processProperties = new String[] { "MAGICK_HOME=/opt/Alfresco/common", "DYLD_LIBRARY_PATH=/opt/Alfresco/common/lib", "LD_LIBRARY_PATH=/opt/Alfresco/common/lib"};Process process = Runtime.getRuntime().exec(commandToExecute, processProperties);‍‍‍‍‍‍‍
http://forums.alfresco.com/en/viewtopic.php?f=10&t=37978
