Page 1 of 1

Batik dependency ? log4j dependency ?

PostPosted: Sat Apr 07, 2012 2:45 am
by Pierre
I've sean threads on these two subject, but concerning older version of docx4j

I'm having two dependency issues :
- one with log4j and sl4j where I can't find a suitable combination of versions that allow the Logger.setLevel() call that docx makes when initializing it's logger. This is not a blocker as it only fails in tests.
- one with batik with the following stack
2012-04-06 15:48:17,152 [WARN] - - Batik not in class path
java.lang.NoClassDefFoundError: org/apache/batik/bridge/UserAgent
at org.apache.fop.image.loader.batik.PreloaderSVG.preloadImage(PreloaderSVG.java:69) ~[fop-patched-0.95.756436.jar:na]
at org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(ImageManager.java:165) [xmlgraphics-commons-1.3.757686.jar:1.4svn]
at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:96) [xmlgraphics-commons-1.3.757686.jar:1.4svn]
at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:112) [xmlgraphics-commons-1.3.757686.jar:1.4svn]
at org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage.getImageInfo(BinaryPartAbstractImage.java:476) [docx4j-2.2.2.jar:na]
at org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage.createImagePart(BinaryPartAbstractImage.java:188) [docx4j-2.2.2.jar:na]
at org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage.createImagePart(BinaryPartAbstractImage.java:152) [docx4j-2.2.2.jar:na]
It is only a WARN, but the image is not created in a way or another ...

Has anyone met one of theses issues, and has a fix at hand ?

Thanks,

Pierre

Re: Batik dependency ? log4j dependency ?

PostPosted: Mon Apr 09, 2012 9:31 pm
by sureshbabubv
Hi Pierre,

I think you are missing the batik jar file in your classpath.

http://www.jarvana.com/jarvana/search?s ... .UserAgent
http://xmlgraphics.apache.org/batik/install.html

Thanks & Regards,
B.V.Suresh Babu.

Re: Batik dependency ? log4j dependency ?

PostPosted: Wed Apr 11, 2012 1:46 pm
by jason
Unless your image is SVG, Batik is probably not why your image is not being created. You generally don't need it, so its not included as a dependency.

Re log4j, docx4j uses 1.2.15. Note that auto configuration can be turned off by setting docx4j.Log4j.Configurator.disabled=true

Re: Batik dependency ? log4j dependency ?

PostPosted: Wed Apr 11, 2012 5:53 pm
by Pierre
Hi,

Thanks Jason, I was compiling a docx4j with a modified Log4jConfigurator, but I'll stick back to vanilla 2.7.1 now ! :)

I was surprised to find that a catch of NoClassDefFound was made a few lines below while using the setLog method of another logger, but not for the root Logger. Why is it so ?

Thanks also sureshbabubv, I had some batik jar, but I did a check of every needed dependency and found a few other missing.

Pierre

Re: Batik dependency ? log4j dependency ?

PostPosted: Wed Apr 11, 2012 8:09 pm
by jason
Pierre wrote:I was surprised to find that a catch of NoClassDefFound was made a few lines below while using the setLog method of another logger, but not for the root Logger. Why is it so ?


As per the comment, in case the FOP jar is not available. If FOP is not available, some of the import statements in org.docx4j.convert.out.pdf.viaXSLFO.Conversion can't be honoured, with the result that the class won't be available/found.