John Brown wrote:
Newkid wrote:
Support Cell,

Could you please advice what needs to be done to run the FOP 0.94 on a
solaris box? I have set the CLASSPATH; Convert the FOP.sh file for UNIX; etc
for all necessary files but when I tried to run FOP on Solaris it's showing
the below error:


Maybe your conversion is incorrect?
For what it's worth, I've been able to reproduce Newkid's problem under Solaris, using the 0.94 binary distribution from UNIX-friendly packaging (i.e., compressed tarballs). I get both the "help" output, and the "severe" failure being reported.

Additional details:

   * Java version: Java(TM) SE Runtime Environment (build
     1.6.0_05-b13), Java HotSpot(TM) Server VM (build 10.0-b19, mixed mode)
   * OS version:  SunOS kiev 5.10 Generic_125101-10 i86pc i386 i86pc
     Solaris
   * I /did/ need to make one change to the "fop" script in order to
     run it correctly: since the version of Bourne shell on my system
     doesn't allow "export VARIABLE=VALUE" syntax, I had to break the
     definition of the IFS variable out as a separate step from its
     export.  (*Note this detail:* we'll come back to it shortly....)



What I found interesting is that if I run the "fop" script as "sh -x ./fop /inputFile/ /outputFile/", and look at the traced execution, it looks fairly reasonable. In fact, if I take the command that's actually be run at the final step (via the "exec" call) and run it by hand, the processing works correctly.

   % # Start failed run, using "fop" script
   % sh -x ./fop readme.fo readme.pdf
   ....
   + eval exec "/usr/local/jdk/bin/java"   -classpath
"/home/ifac/mjh/pub/fop-0.94/lib/xmlgraphics-commons-1.2.jar:/home/ifac/mjh/pub/fop-0.94/lib/xml-apis-1.3.02.jar:/home/ifac/mjh/pub/fop-0.94/lib/xercesImpl-2.7.1.jar:/home/ifac/mjh/pub/fop-0.94/lib/xalan-2.7.0.jar:/home/ifac/mjh/pub/fop-0.94/lib/serializer-2.7.0.jar:/home/ifac/mjh/pub/fop-0.94/lib/commons-logging-1.0.4.jar:/home/ifac/mjh/pub/fop-0.94/lib/commons-io-1.3.1.jar:/home/ifac/mjh/pub/fop-0.94/lib/batik-all-1.6.jar:/home/ifac/mjh/pub/fop-0.94/lib/avalon-framework-4.2.0.jar:/home/ifac/mjh/pub/fop-0.94/build/fop.jar:/home/ifac/mjh/pub/fop-0.94/build/fop-sandbox.jar:/home/ifac/mjh/pub/fop-0.94/build/fop-hyph.jar:.=" org.apache.fop.cli.Main "readme.fo readme.pdf"
   + exec /usr/local/jdk/bin/java -classpath
   
/home/ifac/mjh/pub/fop-0.94/lib/xmlgraphics-commons-1.2.jar:/home/ifac/mjh/pub/fop-0.94/lib/xml-apis-1.3.02.jar:/home/ifac/mjh/pub/fop-0.94/lib/xercesImpl-2.7.1.jar:/home/ifac/mjh/pub/fop-0.94/lib/xalan-2.7.0.jar:/home/ifac/mjh/pub/fop-0.94/lib/serializer-2.7.0.jar:/home/ifac/mjh/pub/fop-0.94/lib/commons-logging-1.0.4.jar:/home/ifac/mjh/pub/fop-0.94/lib/commons-io-1.3.1.jar:/home/ifac/mjh/pub/fop-0.94/lib/batik-all-1.6.jar:/home/ifac/mjh/pub/fop-0.94/lib/avalon-framework-4.2.0.jar:/home/ifac/mjh/pub/fop-0.94/build/fop.jar:/home/ifac/mjh/pub/fop-0.94/build/fop-sandbox.jar:/home/ifac/mjh/pub/fop-0.94/build/fop-hyph.jar:.=
   org.apache.fop.cli.Main readme.fo readme.pdf

   USAGE
   Fop [options] [-fo|-xml] infile [-xsl file]
   [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print]
   <outfile>
    [OPTIONS]
     -d                debug mode
   . . . .
    [Examples]
     Fop foo.fo foo.pdf
     Fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)
     Fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf
     Fop -xml foo.xml -xsl foo.xsl -foout foo.fo
     Fop foo.fo -mif foo.mif
     Fop foo.fo -rtf foo.rtf
     Fop foo.fo -print or Fop -print foo.fo
     Fop foo.fo -awt

   Mar 20, 2008 11:58:59 AM org.apache.fop.cli.Main startFOP
   SEVERE: Exception
   org.apache.fop.apps.FOPException: No output file specified
           at
   
org.apache.fop.cli.CommandLineOptions.checkSettings(CommandLineOptions.java:698)
           at
   org.apache.fop.cli.CommandLineOptions.parse(CommandLineOptions.java:145)
           at org.apache.fop.cli.Main.startFOP(Main.java:154)
           at org.apache.fop.cli.Main.main(Main.java:197)

   % # Run the final Java command by hand
   % /usr/local/jdk/bin/java -classpath
   
/home/ifac/mjh/pub/fop-0.94/lib/xmlgraphics-commons-1.2.jar:/home/ifac/mjh/pub/fop-0.94/lib/xml-apis-1.3.02.jar:/home/ifac/mjh/pub/fop-0.94/lib/xercesImpl-2.7.1.jar:/home/ifac/mjh/pub/fop-0.94/lib/xalan-2.7.0.jar:/home/ifac/mjh/pub/fop-0.94/lib/serializer-2.7.0.jar:/home/ifac/mjh/pub/fop-0.94/lib/commons-logging-1.0.4.jar:/home/ifac/mjh/pub/fop-0.94/lib/commons-io-1.3.1.jar:/home/ifac/mjh/pub/fop-0.94/lib/batik-all-1.6.jar:/home/ifac/mjh/pub/fop-0.94/lib/avalon-framework-4.2.0.jar:/home/ifac/mjh/pub/fop-0.94/build/fop.jar:/home/ifac/mjh/pub/fop-0.94/build/fop-sandbox.jar:/home/ifac/mjh/pub/fop-0.94/build/fop-hyph.jar:.=
   org.apache.fop.cli.Main readme.fo readme.pdf
   %


This made me suspect that the problem was someplace in the shell script and how it's managing things, rather than in the "actual" FOP (Java) code.


*Diagnosis:*
If you take another look at the output when the script is run via "sh -x", the call to "eval" looks pretty hokey, since it's got both of the parameters enclosed within a single pair of quotes (though separated by spaces). Changing the "fop_exec_debug" variable at the top of the shell script to "true", and modifying the final "if" in the script to read:

   if $fop_exec_debug ; then
       echo $fop_exec_command
       for f in $fop_exec_args ; do echo $f ; done      # Added for
   debugging Solaris problems
   fi


I found that the both of my command-line parameters ("readme.fo" and "readme.pdf") are being treated/printed as a single value within the variable's contents, rather than as two /separate/ values, which is more than a little off. My immediate suspicion was that there was a problem with the "IFS" setting in the script.

I went back and checked the script, and found that IFS is being set just to the newline character, and does not include spaces. (This is in both the copy of "fop" included in the distribution, and after I'd modified it to break the "export" out to a separate command, as described above.)


*The solution:*
If you modify the value for IFS (line 25 of the "fop" script in the 0.94 binary distribution) to include a space, the script should work correctly. (At the very least, it did for me.)

Under versions of Solaris like mine, you'll need to have something like the following:

   IFS="<space>
   "
   export IFS


where "<space>" is replaced with a single space character. Under versions of the Bourne shell that support exporting and setting a shell variable in a single statement, you can get away with:

   export IFS="<space>
   "


*Final comments:*

I would like to suggest that the Solaris-compatible change I've outlined above (i.e., breaking the assignment and export into two separate statements) should be included in the upcoming 0.95 release.

I would also like to suggest that the IFS value in the "fop" script should be modified to include a standard space character.


-mjh
--
Matthew J. Healy
Department of Computer Science, RIT
102 Lomb Memorial Drive, Rochester, NY 14623
mailto:[EMAIL PROTECTED]
http://www.cs.rit.edu/~mjh
Voice: (585) 248-3425

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to