I had an unexpected problem running fop at work today. I run fop under windows using cygwin and have used it for months with no problem. I installed something else on cygwin, and when I ran FOP today (using the bash script), I got a no classfound error.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/ImageContext
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
   [etc.]

I am using version:

FOP Version svn-trunk

I opened the FOP script and it seems that the problem lies here:

  FOP_HOME=`cygpath --$format "$FOP_HOME"`
  LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"`
  LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"`
  if [ -n "$CLASSPATH" ] ; then
    CP_TEMP=`cygpath --path --unix "$CLASSPATH"`
    CLASSPATH=`cygpath --path --$format "$CP_TEMP"`
  fi
  CYGHOME=`cygpath --$format "$HOME"`

The cygpath is actually truncating the LOCALCLASSPATH name because it is too long. If I insert

echo $LOCALCLASSPATH

I get something like this:

C:/ava/fop-20111024/lib/xmlgraphics-commons-1.5svn.jar
   ^^^

Note how the C:/ava should be C:/java.

I tested out the cypath command on its own, and sure enough, it truncates the first letter if the path name is too long.

However, even if I insert a sed command to change the LOCALCLASSPATH back to

C:java/[rest of path name]

I still get the same error.

I also tried pasting the full classpath name back into the script and setting the LOCALCLASSPATH name to it, but this didn't work either.

How should I set the classpath under cygwin? The cygwin path to the first jar is:

/cgywin/java/fop-20111024/lib/xmlgraphics-commons-1.5svn.jar

I need a quick fix for work, and I believe I can copy the file to /cygwin/java/fop-20111024, and then run

java -jar -fo file.fo -pdf file.pdf

In fact, I did this already, and the file got converted with no error messages. I just didn't have time to look at the resulting PDF.

Thanks!

Paul


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to