Short Description
I have to run Ghostscript on AIX. It works in command line:
XXXXXXXX:i2zate:/home/i2zate>/usr/bin/gs -dFIXEDMEDIA -dPDFFitPage -dFirstPage=1 -dLastPage=1 -dBATCH -dNOPAUSE -dNOPROMPT -dSAFER -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 -dDEVICEWIDTH=90 -dDEVICEHEIGHT=120 -dORIENT1=true -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=1.jpg porsche.pdf
GPL Ghostscript 8.70 (2009-07-31)
Copyright (C) 2009 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
If I run the same from Java, it displays an error:
ERROR: exec(): 0509-036 Cannot load program /usr/bin/gs because of the following errors:
ERROR: 0509-022 Cannot load module /usr/lib/libcairo.a(libcairo.so.2).
ERROR: 0509-150 Dependent module /usr/lib/libXrender.a(libXrender.so.1) could not be loaded.
ERROR: 0509-152 Member libXrender.so.1 is not found in archive
ERROR: 0509-022 Cannot load module gs.
ERROR: 0509-150 Dependent module /usr/lib/libcairo.a(libcairo.so.2) could not be loaded.
ERROR: 0509-022 Cannot load module .
I dont understand, why this happens. Do you have any idea? Some environmental info you can find below. If you need something else, let me know please.
Deeper Information
The java code I use:
package biz;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class DummyCaller {
public static void main(String[] args) throws IOException, InterruptedException {
printSystemProperties();
System.out.println();
printEnvironment();
Process process = Runtime.getRuntime().exec( args );
new StreamReader("OUT ", process.getInputStream() ).start();
new StreamReader("ERROR", process.getErrorStream() ).start();
process.waitFor();
}
private static void printSystemProperties() {
System.out.println( "System.getProperties(): " );
List<String> keys = new ArrayList<String>();
for (Object key : System.getProperties().keySet()) {
keys.add( (String) key );
}
Collections.sort(keys);
for (Object key : keys ) {
System.out.println( "" + key + "=" + System.getProperty((String) key) );
}
}
private static void printEnvironment() {
System.out.println( "System.getEnv(): " );
List<String> keys = new ArrayList<String>();
keys.addAll(System.getenv().keySet());
Collections.sort(keys);
for (Object key : keys ) {
System.out.println( "" + key + "=" + System.getenv().get( key) );
}
}
public static class StreamReader extends Thread {
private BufferedReader br;
private String streamName;
public StreamReader(String streamName, InputStream is ) {
super();
this.streamName = streamName;
br = new BufferedReader( new InputStreamReader(is));
}
@Override
public void run() {
String line = null;
try {
while ( (line = br.readLine() ) != null ) {
System.out.println( streamName + ": " + line );
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
The full output of the java program (some not relevant sensitive info XXXX-ed):
XXXXXXXHOST:i2zate:/home/i2zate>java -cp . biz.DummyCaller /usr/bin/gs -dFIXEDMEDIA -dPDFFitPage -dFirstPage=1 -dLastPage=1 -dBATCH -dNOPAUSE -dNOPROMPT -dSAFER -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 -dDEVICEWIDTH=90 -dDEVICEHEIGHT=120 -dORIENT1=true -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=1.jpg porsche.pdf
System.getProperties():
com.ibm.cpu.endian=big
com.ibm.jcl.checkClassPath=
com.ibm.oti.configuration=scar
com.ibm.oti.jcl.build=20111101_1053
com.ibm.oti.shared.enabled=false
com.ibm.oti.vm.bootstrap.library.path=/usr/java6_64/jre/lib/ppc64/default:/usr/java6_64/jre/lib/ppc64
com.ibm.oti.vm.library.version=24
com.ibm.util.extralibs.properties=
com.ibm.vm.bitmode=64
file.encoding=ISO8859-1
file.separator=/
ibm.signalhandling.rs=false
ibm.signalhandling.sigchain=true
ibm.signalhandling.sigint=true
ibm.system.encoding=ISO8859-1
java.assistive=ON
java.awt.fonts=
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
java.awt.printerjob=sun.print.PSPrinterJob
java.class.path=.
java.class.version=50.0
java.compiler=j9jit24
java.endorsed.dirs=/usr/java6_64/jre/lib/endorsed
java.ext.dirs=/usr/java6_64/jre/lib/ext
java.fullversion=JRE 1.6.0 IBM J9 2.4 AIX ppc64-64 jvmap6460sr10-20111207_96808 (JIT enabled, AOT enabled)
J9VM - 20111207_096808
JIT - r9_20111107_21307ifx1
GC - 20110519_AA
java.home=/usr/java6_64/jre
java.io.tmpdir=/tmp/
java.jcl.version=20111104_02
java.library.path=/usr/java6_64/jre/lib/ppc64/default:/usr/java6_64/jre/lib/ppc64:/usr/java6_64/jre/lib/ppc64:/usr/java6_64/jre/lib/ppc64/default:/usr/java6_64/jre/lib/ppc64/j9vm:/usr/java6_64/jre/lib/ppc64:/usr/java6_64/jre/../lib/ppc64:/usr/lib:/usr/lib
java.runtime.name=Java(TM) SE Runtime Environment
java.runtime.version=pap6460sr10-20111208_01 (SR10)
java.specification.name=Java Platform API Specification
java.specification.vendor=Sun Microsystems Inc.
java.specification.version=1.6
java.util.prefs.PreferencesFactory=java.util.prefs.FileSystemPreferencesFactory
java.vendor=IBM Corporation
java.vendor.url=http://www.ibm.com/
java.version=1.6.0
java.vm.info=JRE 1.6.0 IBM J9 2.4 AIX ppc64-64 jvmap6460sr10-20111207_96808 (JIT enabled, AOT enabled)
J9VM - 20111207_096808
JIT - r9_20111107_21307ifx1
GC - 20110519_AA
java.vm.name=IBM J9 VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Sun Microsystems Inc.
java.vm.specification.version=1.0
java.vm.vendor=IBM Corporation
java.vm.version=2.4
jxe.current.romimage.version=15
jxe.lowest.romimage.version=15
line.separator=
os.arch=ppc64
os.encoding=ISO8859-1
os.name=AIX
os.version=6.1
path.separator=:
sun.arch.data.model=64
sun.boot.class.path=/usr/java6_64/jre/lib/ppc64/default/jclSC160/vm.jar:/usr/java6_64/jre/lib/annotation.jar:/usr/java6_64/jre/lib/beans.jar:/usr/java6_64/jre/lib/java.util.jar:/usr/java6_64/jre/lib/jndi.jar:/usr/java6_64/jre/lib/logging.jar:/usr/java6_64/jre/lib/security.jar:/usr/java6_64/jre/lib/sql.jar:/usr/java6_64/jre/lib/ibmorb.jar:/usr/java6_64/jre/lib/ibmorbapi.jar:/usr/java6_64/jre/lib/ibmcfw.jar:/usr/java6_64/jre/lib/rt.jar:/usr/java6_64/jre/lib/charsets.jar:/usr/java6_64/jre/lib/resources.jar:/usr/java6_64/jre/lib/ibmpkcs.jar:/usr/java6_64/jre/lib/ibmcertpathfw.jar:/usr/java6_64/jre/lib/ibmjgssfw.jar:/usr/java6_64/jre/lib/ibmjssefw.jar:/usr/java6_64/jre/lib/ibmsaslfw.jar:/usr/java6_64/jre/lib/ibmjcefw.jar:/usr/java6_64/jre/lib/ibmjgssprovider.jar:/usr/java6_64/jre/lib/ibmjsseprovider2.jar:/usr/java6_64/jre/lib/ibmcertpathprovider.jar:/usr/java6_64/jre/lib/ibmxmlcrypto.jar:/usr/java6_64/jre/lib/management-agent.jar:/usr/java6_64/jre/lib/xml.jar:/usr/java6_64/jre/lib/jlm.jar:/usr/java6_64/jre/lib/javascript.jar
sun.boot.library.path=/usr/java6_64/jre/lib/ppc64/default:/usr/java6_64/jre/lib/ppc64
sun.cpu.endian=big
sun.io.unicode.encoding=UnicodeBig
sun.java.command=biz.DummyCaller /usr/bin/gs -dFIXEDMEDIA -dPDFFitPage -dFirstPage=1 -dLastPage=1 -dBATCH -dNOPAUSE -dNOPROMPT -dSAFER -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 -dDEVICEWIDTH=90 -dDEVICEHEIGHT=120 -dORIENT1=true -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=1.jpg porsche.pdf
sun.java.launcher=SUN_STANDARD
sun.java2d.fontpath=
sun.jnu.encoding=ISO8859-1
user.country=US
user.dir=/home/i2zate
user.home=/home/i2zate
user.language=en
user.name=i2zate
user.timezone=
user.variant=
System.getEnv():
AIXTHREAD_SCOPE=S
AUTHSTATE=compat
AWK=/usr/bin/awk
A__z=! LOGNAME
BAR_BSALIB_PATH=/usr/tivoli/tsm/client/api/bin/xbsa.o
CORE_MMAP=yes
CSP_HOME=/opt/csp/at/test
DSMI_CONFIG=/usr/tivoli/tsm/client/api/bin/dsm.opt
DSMI_DIR=/usr/tivoli/tsm/client/api/bin
DSMI_INF_DIR=/usr/tivoli/tsm/client/informix/bin
DSMI_LOG=/var/opt/RRZ/log
DSMI_ORC_CONFIG=/usr/tivoli/tsm/client/oracle/bin/dsm.opt
DSMO_DEBUG=/var/opt/RRZ/log/orcagent.log
DSMO_NODE=XXXXXXXX_ORA
DSM_CONFIG=/usr/tivoli/tsm/client/ba/bin/dsm.opt
DSM_DIR=/usr/tivoli/tsm/client/ba/bin
DSM_LOG=/var/opt/RRZ/log
EDITOR=vi
HOME=/home/i2zate
HOST=XXXXXXXXX
IBM_JAVA_COMMAND_LINE=java -cp . biz.DummyCaller /usr/bin/gs -dFIXEDMEDIA -dPDFFitPage -dFirstPage=1 -dLastPage=1 -dBATCH -dNOPAUSE -dNOPROMPT -dSAFER -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 -dDEVICEWIDTH=90 -dDEVICEHEIGHT=120 -dORIENT1=true -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=1.jpg porsche.pdf
IBM_JVM_AIXTHREAD_SCOPE_NEW_VALUE=S
IBM_JVM_CHANGED_ENVVARS_3211296=AIXTHREAD_SCOPE,NULLPTR,CORE_MMAP
IBM_JVM_CORE_MMAP_NEW_VALUE=yes
IBM_JVM_NULLPTR_NEW_VALUE=NOSEGV
JAVA_HOME=/usr/java6_64/jre
JOBS=/opt/RRZ/AIX
LANG=en_US
LC_CTYPE=C
LC__FASTMSG=true
LIBPATH=/usr/java6_64/jre/lib/ppc64/j9vm:/usr/java6_64/jre/lib/ppc64:/usr/java6_64/jre/../lib/ppc64:/usr/lib
LOCPATH=/usr/lib/nls/loc
LOGIN=i2zate
LOGNAME=i2zate
LOGS=/var/opt/RRZ/log
MAIL=/usr/spool/mail/i2zate
MAILMSG=[YOU HAVE NEW MAIL]
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
NUI_NOCHECKSUM=1
NUI_NOTESDIR=/opt/lotus
NULLPTR=NOSEGV
ODMDIR=/etc/objrepos
PATH=/usr/java6_64/jre/bin:/usr/java6_64/jre/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/i2zate/bin:/usr/bin/X11:/sbin:.
PRINTER=XXXXXXXX
PROTS=/var/opt/RRZ/prots
PS1=$HOST:$USER:$PWD>
PWD=/home/i2zate
SHELL=/usr/bin/ksh
SHLVL=1
SPOC=/opt/RRZ/AIX/spoc
SPOCVER=6.1
SSH_CLIENT=XXXXXXXXXXXXXXXXXXXX
SSH_CONNECTION=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SSH_TTY=/dev/pts/0
SYS=AIX
TAPE=/dev/rmt0
TERM=xterm
TSM=/usr/tivoli/tsm/client/ba/bin/
TZ=MET-1METDST,M3.5.0/2:00,M10.5.0/3:00
USER=i2zate
_=/usr/java6_64/jre/bin/java
ERROR: exec(): 0509-036 Cannot load program /usr/bin/gs because of the following errors:
ERROR: 0509-022 Cannot load module /usr/lib/libcairo.a(libcairo.so.2).
ERROR: 0509-150 Dependent module /usr/lib/libXrender.a(libXrender.so.1) could not be loaded.
ERROR: 0509-152 Member libXrender.so.1 is not found in archive
ERROR: 0509-022 Cannot load module gs.
ERROR: 0509-150 Dependent module /usr/lib/libcairo.a(libcairo.so.2) could not be loaded.
ERROR: 0509-022 Cannot load module .
Environment info from the same command line session:
XXXXXXXX:i2zate:/home/i2zate>set
AUTHSTATE=compat
AWK=/usr/bin/awk
A__z='! LOGNAME'
BAR_BSALIB_PATH=/usr/tivoli/tsm/client/api/bin/xbsa.o
BASH=/usr/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="00" [2]="16" [3]="1" [4]="release" [5]="powerpc-ibm-aix5.1")
BASH_VERSION='3.00.16(1)-release'
COLUMNS=168
CSP_HOME=/opt/csp/at/test
DIRSTACK=()
DSMI_CONFIG=/usr/tivoli/tsm/client/api/bin/dsm.opt
DSMI_DIR=/usr/tivoli/tsm/client/api/bin
DSMI_INF_DIR=/usr/tivoli/tsm/client/informix/bin
DSMI_LOG=/var/opt/RRZ/log
DSMI_ORC_CONFIG=/usr/tivoli/tsm/client/oracle/bin/dsm.opt
DSMO_DEBUG=/var/opt/RRZ/log/orcagent.log
DSMO_NODE=XXXXXXXX_ORA
DSM_CONFIG=/usr/tivoli/tsm/client/ba/bin/dsm.opt
DSM_DIR=/usr/tivoli/tsm/client/ba/bin
DSM_LOG=/var/opt/RRZ/log
EDITOR=vi
EUID=623
GROUPS=()
HISTFILE=/home/i2zate/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/home/i2zate
HOST=XXXXXXXX
HOSTNAME=XXXXXXXX
HOSTTYPE=powerpc
IFS=$' \t\n'
JAVA_HOME=/usr/java6_64/jre
JOBS=/opt/RRZ/AIX
LANG=en_US
LC_CTYPE=C
LC__FASTMSG=true
LINES=46
LOCPATH=/usr/lib/nls/loc
LOGIN=i2zate
LOGNAME=i2zate
LOGS=/var/opt/RRZ/log
MACHTYPE=powerpc-ibm-aix5.1
MAIL=/usr/spool/mail/i2zate
MAILCHECK=60
MAILMSG='[YOU HAVE NEW MAIL]'
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
NUI_NOCHECKSUM=1
NUI_NOTESDIR=/opt/lotus
ODMDIR=/etc/objrepos
OPTERR=1
OPTIND=1
OSTYPE=aix5.1
PATH=/usr/java6_64/jre/bin:/usr/java6_64/jre/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/i2zate/bin:/usr/bin/X11:/sbin:.
PIPESTATUS=([0]="0")
PPID=2556030
PRINTER=prrz056
PROTS=/var/opt/RRZ/prots
PS1='$HOST:$USER:$PWD>'
PS2='> '
PS4='+ '
PWD=/home/i2zate
SHELL=/usr/bin/ksh
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=1
SPOC=/opt/RRZ/AIX/spoc
SPOCVER=6.1
SSH_CLIENT='XXXXXXXXXXXXXXXXXXXX'
SSH_CONNECTION='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
SSH_TTY=/dev/pts/0
SYS=AIX
TAPE=/dev/rmt0
TERM=xterm
TSM=/usr/tivoli/tsm/client/ba/bin/
TZ=MET-1METDST,M3.5.0/2:00,M10.5.0/3:00
UID=623
USER=i2zate
_=porsche.pdf