最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已彻底解决】docbook中cygwin/linux下的fop运行出错:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/ImageContext

Docbook crifan 2477浏览 0评论

docbook中,已经用xsltproc生成了fo文件,接着想要用fop去生成对应的pdf文件。

之前已经可以用windows的fop.cmd或fop.bat去生成pdf了。

但是一直想要用cygwin下面的那个fop去生成pdf,然后其会出错:

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ /cygdrive/e/Dev_Root/docbook/tools/fop-1.0/fop -c /cygdrive/e/Dev_Root/docbook/dev/config/fop/conf/fop.xconf ../output/fo/MPEG_VBR.fo -pdf ../output/pdf/MPEG_VBR.pdf
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/ImageContext
。。。
        at org.apache.fop.cli.Main.main(Main.java:205)
Caused by: java.lang.ClassNotFoundException: org.apache.xmlgraphics.image.loader.ImageContext
        at java.net.URLClassLoader$1.run(Unknown Source)
。。。
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 15 more

现在想要搞定此问题,为接下来的写cygwin下的makefile做准备。

【解决过程】

1.看起来像是没有找到xmlgraphics相关的java库,所以去试试把其添加进来。

去把%FOP_HOME\lib\xmlgraphics-commons-1.4.jar;添加到windows的环境变量CLASSPATH中,结果也还是同样错误。

但是同时多了这个警告:

cygwin warning:
  MS-DOS style path detected: E:\Dev_Root\docbook\config\tool\fop\fop-1.0;
  Preferred POSIX equivalent is: /cygdrive/e/Dev_Root/docbook/config/tool/fop/fop-1.0;
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

2.所以去试试,把原先的FOP_HOME从E:\Dev_Root\docbook\config\tool\fop\fop-1.0;

改为

/cygdrive/e/Dev_Root/docbook/tools/fop-1.0

结果没了此cygwin的warning,但是问题依旧,还是同样错误。

3.后来去看了fop脚本的内容,无意间发现有关于jar的配置,所以去试了试,把:

# add fop.jar, fop-sandbox and fop-hyph.jar, which reside in $FOP_HOME/build
LOCALCLASSPATH=${FOP_HOME}/build/fop.jar${pathSepChar}${FOP_HOME}/build/fop-sandbox.jar${pathSepChar}${FOP_HOME}/build/fop-hyph.jar${pathSepChar}$LOCALCLASSPATH

改为:

# add fop.jar, fop-sandbox and fop-hyph.jar, which reside in $FOP_HOME/build
LOCALCLASSPATH=${FOP_HOME}/lib/xmlgraphics-commons-1.4.jar${FOP_HOME}/build/fop.jar${pathSepChar}${FOP_HOME}/build/fop-sandbox.jar${pathSepChar}${FOP_HOME}/build/fop-hyph.jar${pathSepChar}$LOCALCLASSPATH

结果是上面那个错误没了,却出现下面的错误:

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ /cygdrive/e/Dev_Root/docbook/tools/fop-1.0/fop -c /cygdrive/e/Dev_Root/docbook/dev/config/fop/conf/fop.xconf ../output/fo/MPEG_VBR.fo -pdf ../output/pdf/MPEG_VBR.pdf
cygpath: error converting "/cygdrive/e/ygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-ext-1.3.04.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-1.3.04.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xercesImpl-2.7.1.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xalan-2.7.0.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/serializer-2.7.0.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/fop-hyph.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/commons-logging-1.0.4.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/commons-io-1.3.1.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/batik-all-1.7.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/avalon-framework-4.2.0.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/build/fop.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/build/fop-sandbox.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/build/fop-hyph.jar:.:/cygdrive/d/Program Files/Java/jre7/lib:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/build/fop.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib:%FOP_HOME/lib/fop-hyph.jar:%FOP_HOME/lib/xmlgraphics-commons-1.4.jar:/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/build/fop-hyph.jar" - Unknown error -1
错误: 找不到或无法加载主类 org.apache.fop.cli.Main

后来看到了,原来是上面改的时候,忘了加一个pathSepChar,加上后,变成:

# add fop.jar, fop-sandbox and fop-hyph.jar, which reside in $FOP_HOME/build
LOCALCLASSPATH=${FOP_HOME}/lib/xmlgraphics-commons-1.4.jar{pathSepChar}${FOP_HOME}/build/fop.jar${pathSepChar}${FOP_HOME}/build/fop-sandbox.jar${pathSepChar}${FOP_HOME}/build/fop-hyph.jar${pathSepChar}$LOCALCLASSPATH

然后结果为还是最开始的错误,还是:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/ImageContext

4.后来才看到,原来上面去手动添加xmlgraphics是没变要的,因为fop中已经通过这部分代码:

# add in the dependency .jar files, which reside in $FOP_HOME/lib
OLD_IFS=$IFS
IFS="
"
DIRLIBS=${FOP_HOME}/lib/*.jar
for i in ${DIRLIBS}
do
    # if the directory is empty, then it will return the input string
    # this is stupid, so case for it
    if [ "$i" != "${DIRLIBS}" ] ; then
      if [ -z "$LOCALCLASSPATH" ] ; then
        LOCALCLASSPATH=$i
      else
        LOCALCLASSPATH="$i"${pathSepChar}$LOCALCLASSPATH
      fi
    fi
done
IFS=$OLD_IFS

做了对应的事情了。

5.刚注意到,之前不小心,添加CLASSPATH的时候,都写错了,把%FOP_HOME%的第二个%漏掉了,现在改正如下:

.;%JAVA_HOME%\lib;%FOP_HOME%\build\fop.jar;%FOP_HOME%\lib;%FOP_HOME%\lib\fop-hyph.jar;%FOP_HOME%\lib\xmlgraphics-commons-1.4.jar;

但是结果也还是不行。

6.后来想到了,还是先去试试本身fop是否正常运行,结果也是同样错误:

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ /cygdrive/e/Dev_Root/docbook/tools/fop-1.0/fop
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/ImageContext
        at java.lang.ClassLoader.defineClass1(Native Method)
。。。

6. 然后参考fop中所支持的参数,添加了debug支持,可以看到具体执行过程:

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src $ /cygdrive/e/Dev_Root/docbook/tools/fop-1.0/fop --execdebug exec "/cygdrive/d/Program Files/Java/jre7/bin/java" -classpath "E:/ygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-ext-1.3.04.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-1.3.04.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xercesImpl-2.7.1.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xalan-2.7.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/serializer-2.7.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/fop-hyph.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/commons-logging-1.0.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/commons-io-1.3.1.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/batik-all-1.7.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/avalon-framework-4.2.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-sandbox.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-hyph.jar;.;D:/Program Files/Java/jre7/lib;E:/Dev_Root/docbook/config/tool/fop/fop-1.0/build/fop.jar;E:/Dev_Root/docbook/config/tool/fop/fop-1.0/lib;E:/Dev_Root/docbook/config/tool/fop/fop-1.0/lib/fop-hyph.jar;E:/Dev_Root/docbook/config/tool/fop/fop-1.0/lib/xmlgraphics-commons-1.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-hyph.jar" org.apache.fop.cli.Main Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/ImageContext at java.lang.ClassLoader.defineClass1(Native Method) 。。。

Caused by: java.lang.ClassNotFoundException: org.apache.xmlgraphics.image.loader.ImageContext 。。。

然后就发现了,原来其中执行过程,路径都是错的:

其所添加进去的xml-graphics的路径是:

E:/ygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar;

明显是错的,找不到的。

但是,手动添加进去的xmlgraphics的路径,也是对的:

E:/Dev_Root/docbook/config/tool/fop/fop-1.0/lib/xmlgraphics-commons-1.4.jar;

所以,按理来说,也该能找到xmlgraphics才对。

刚刚发现,上面的:

E:/Dev_Root/docbook/config/tool/fop/fop-1.0/lib/xmlgraphics-commons-1.4.jar;

其实是不存在的,真正存在的路径应该是:

/cygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar;

即:

E:/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar;

但是此处的确没有正确的添加此路径到classpath中,所以,要去搞清楚原因。

然后才发现,原来windows中的系统变量FOP_HOME之前一直都是设置的是:

E:\Dev_Root\docbook\config\tool\fop\fop-1.0

而不是真正有效的:

E:\Dev_Root\docbook\tools\fop-1.0

然后现在设置上述正确的路径,然后再去试试。

此时,再去运行fop,结果就是对的了:

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ /cygdrive/e/Dev_Root/docbook/tools/fop-1.0/fop
cygwin warning:
  MS-DOS style path detected: E:\Dev_Root\docbook\tools\fop-1.0
  Preferred POSIX equivalent is: /cygdrive/e/Dev_Root/docbook/tools/fop-1.0
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
FOP Version 1.0

USAGE
fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile>
 [OPTIONS]
。。。
 [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 -xml - -xsl foo.xsl -pdf -
  fop foo.fo -mif foo.mif
  fop foo.fo -rtf foo.rtf
  fop foo.fo -print
  fop foo.fo -awt

接下来,还是想要去验证一下关于路径的配置的事情。

【关于FOP_HOME的参数配置】

(1)

FOP_HOME = E:\Dev_Root\docbook\tools\fop-1.0;

结果是:同样会出现错误:

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ echo $FOP_HOME
E:\Dev_Root\docbook\tools\fop-1.0;

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ cygpath $FOP_HOME
/cygdrive/e/Dev_Root/docbook/tools/fop-1.0;

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ /cygdrive/e/Dev_Root/docbook/tools/fop-1.0/fop --execdebug
exec "/cygdrive/d/Program Files/Java/jre7/bin/java" -classpath "E:/ygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-ext-1.3.04.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-1.3.04.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xercesImpl-2.7.1.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xalan-2.7.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/serializer-2.7.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/fop-hyph.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/commons-logging-1.0.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/commons-io-1.3.1.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/batik-all-1.7.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/avalon-framework-4.2.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-sandbox.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-hyph.jar;.;D:/Program Files/Java/jre7/lib;E:/Dev_Root/docbook/tools/fop-1.0;E:/build/fop.jar;E:/Dev_Root/docbook/tools/fop-1.0;E:/lib;E:/Dev_Root/docbook/tools/fop-1.0;E:/lib/fop-hyph.jar;E:/Dev_Root/docbook/tools/fop-1.0;E:/lib/xmlgraphics-commons-1.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-hyph.jar" org.apache.fop.cli.Main
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/ImageContext
        at java.lang.ClassLoader.defineClass1(Native Method)
。。。

因为其最后添加了一个分号,导致其他路径也是不正常,导致找不到对应的java库,所以报错。

(2)

FOP_HOME = E:\Dev_Root\docbook\tools\fop-1.0

是刚才的设置,结果那是的确可以正常运行的:

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ echo $FOP_HOME
E:\Dev_Root\docbook\tools\fop-1.0

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ cygpath $FOP_HOME
/cygdrive/e/Dev_Root/docbook/tools/fop-1.0

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ /cygdrive/e/Dev_Root/docbook/tools/fop-1.0/fop --execdebug
exec "/cygdrive/d/Program Files/Java/jre7/bin/java" -classpath "E:/ygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commo             ns-1.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-ext-1.3.04.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-1.3.04.ja             r;E:/Dev_Root/docbook/tools/fop-1.0/lib/xercesImpl-2.7.1.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xalan-2.7.0.jar;E:/Dev_Root/do             cbook/tools/fop-1.0/lib/serializer-2.7.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/fop-hyph.jar;E:/Dev_Root/docbook/tools/fop-1.0             /lib/commons-logging-1.0.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/commons-io-1.3.1.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/b             atik-all-1.7.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/avalon-framework-4.2.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop.jar             ;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-sandbox.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-hyph.jar;.;D:/Program Files/             Java/jre7/lib;E:/Dev_Root/docbook/tools/fop-1.0/build/fop.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib;E:/Dev_Root/docbook/tools/fop             -1.0/lib/fop-hyph.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/f             op-hyph.jar" org.apache.fop.cli.Main
FOP Version 1.0

USAGE
fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile>
 [OPTIONS]
  -version          print FOP version and exit

(3)

FOP_HOME = /cygdrive/e/Dev_Root/docbook/tools/fop-1.0

结果是同样是可以正常运行的:

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ echo $FOP_HOME
/cygdrive/e/Dev_Root/docbook/tools/fop-1.0

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$ cygpath $FOP_HOME
/cygdrive/e/Dev_Root/docbook/tools/fop-1.0

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/books/VBR/src
$  /cygdrive/e/Dev_Root/docbook/tools/fop-1.0/fop --execdebug
exec "/cygdrive/d/Program Files/Java/jre7/bin/java" -classpath "E:/ygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-ext-1.3.04.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-1.3.04.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xercesImpl-2.7.1.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xalan-2.7.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/serializer-2.7.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/fop-hyph.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/commons-logging-1.0.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/commons-io-1.3.1.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/batik-all-1.7.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/avalon-framework-4.2.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-sandbox.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-hyph.jar;.;D:/Program Files/Java/jre7/lib;E:/Dev_Root/docbook/tools/fop-1.0/build/fop.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib;E:/Dev_Root/docbook/tools/fop-1.0/lib/fop-hyph.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-hyph.jar" org.apache.fop.cli.Main
FOP Version 1.0

USAGE
fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile>
 [OPTIONS]
  -version          print FOP version and exit
。。。

【关于FOP_HOME的配置的总结】

在windows下,对于环境变量的FOP_HOME的配置,可以正常配置为windows的路径:

FOP_HOME = E:\Dev_Root\docbook\tools\fop-1.0

或cygwin的路径:

FOP_HOME = /cygdrive/e/Dev_Root/docbook/tools/fop-1.0

但是注意不能在最后添加windows中的分号,即不能这样:

FOP_HOME = E:\Dev_Root\docbook\tools\fop-1.0;

否则会导致fop找不到对应的xmlgraphics/等java库,而无法正常运行的。

 

【总结】

此处我这里fop运行出错:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/ImageContext

其根本原因在于,对于FOP_HOME的路径设置错误了。

而之所以设置错误,是由于之前就正确设置的FOP_HOME的路径,但是由于后来fop被移动到别的位置了,但是FOP_HOME的环境变量却没有及时更新,而导致了现在运行fop出错了。

所以,其他人遇到fop的类似:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/ImageContext

的问题,可以从这些方面去找问题的原因:

1.看看对应的FOP_HOME的环境变量是否正确设置

2.看看缺少的java的库,是否的确真的不存在。比如此处的xmlgraphics,要确定,fop的lib下面,的确存在了对应的xmlgraphics-commons-1.4.jar文件,fop运行过程中,就会自动找到这些文件的。

3.如果还解决不了问题,那么给fop添加调试参数:

./fop –execdebug

这样就可以看到fop执行的整个过程了,其中如果有不正确的路径,就可以去找找为何该路径出错了。这样一般就可以找到问题原因并解决问题了。

【后记】

关于fop脚本,会导致一些类似于:

E:/ygdrive/e/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar;

的路径,其中,很明显可以看出,E:/ygdrive/应该是E:/cygdrive/,但是却被fop处理过程中搞错了,后来参考:

classpath suddenly not found with fop script and cygwin

中,其也遇到类似问题,说是cygpath截断了对应的路径,导致出错。然后后面也给出了解决办法,但是好像也写入到绝对路径到classpath的,总觉得办法还是不够好,所以也懒得再去弄了。

期望有人给出更好的解决方案,或者有空自己再去折腾吧。

【后记2】

后已通过自己解决此问题,详情参看:

【终极解决】fop错误:Exception in thread "main" java.lang.NoClassDefFoundError:org/apache/xmlgraphics/image/loader/ImageContext 的终极解决办法,即cygpath有bug,转换路径出错,导致部分路径被截断

转载请注明:在路上 » 【已彻底解决】docbook中cygwin/linux下的fop运行出错:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/ImageContext

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.200 seconds, using 22.38MB memory