Hi,
I have a similar problem like (https://answers.atlassian.com/questions/104121/i-m-blocked-help-cannot-be-cast-to-javax-xml-parsers-saxparserfactory?page=1#122989) but i'm really stuck finding a solution. I try to use apache FOP in my jira Plugin.
This is the interesting part of my pom:
<dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>fop</artifactId> <version>1.0</version> <exclusions> <exclusion> <groupId>xalan</groupId> <artifactId>xalan</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.3</version> <scope>provided</scope> </dependency>
I have excluded Xalan since it is shipped with JIRA. This is the dependency tree of fop:
[INFO] +- org.apache.xmlgraphics:fop:jar:1.0:compile [INFO] | +- org.apache.xmlgraphics:xmlgraphics-commons:jar:1.4:compile [INFO] | +- org.apache.xmlgraphics:batik-svg-dom:jar:1.7:compile [INFO] | | +- org.apache.xmlgraphics:batik-anim:jar:1.7:compile [INFO] | | +- org.apache.xmlgraphics:batik-css:jar:1.7:compile [INFO] | | +- org.apache.xmlgraphics:batik-dom:jar:1.7:compile [INFO] | | +- org.apache.xmlgraphics:batik-parser:jar:1.7:compile [INFO] | | +- org.apache.xmlgraphics:batik-util:jar:1.7:compile [INFO] | | +- xml-apis:xml-apis:jar:1.3.04:compile [INFO] | | \- xml-apis:xml-apis-ext:jar:1.3.04:compile [INFO] | +- org.apache.xmlgraphics:batik-bridge:jar:1.7:compile [INFO] | | +- org.apache.xmlgraphics:batik-script:jar:1.7:compile [INFO] | | \- org.apache.xmlgraphics:batik-xml:jar:1.7:compile [INFO] | +- org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile [INFO] | +- org.apache.xmlgraphics:batik-gvt:jar:1.7:compile [INFO] | +- org.apache.xmlgraphics:batik-transcoder:jar:1.7:compile [INFO] | | \- org.apache.xmlgraphics:batik-svggen:jar:1.7:compile [INFO] | +- org.apache.xmlgraphics:batik-extension:jar:1.7:compile [INFO] | +- org.apache.xmlgraphics:batik-ext:jar:1.7:compile [INFO] | +- commons-logging:commons-logging:jar:1.0.4:compile [INFO] | +- commons-io:commons-io:jar:1.3.1:compile [INFO] | +- org.apache.avalon.framework:avalon-framework-api:jar:4.3.1:compile [INFO] | \- org.apache.avalon.framework:avalon-framework-impl:jar:4.3.1:compile [INFO] \- javax.servlet:servlet-api:jar:2.3:provided
I got this ClassCastException on TransformerFactory tFactory = TransformerFactory.newInstance();:
[INFO] [talledLocalContainer] JAXP: find factoryId =javax.xml.transform.TransformerFactory [INFO] [talledLocalContainer] JAXP: found system property, value=org.apache.xalan.processor.TransformerFactoryImpl [INFO] [talledLocalContainer] JAXP: created new instance of class org.apache.xalan.processor.TransformerFactoryImpl using ClassLoader: com.atlassian.plugin.osgi.util.BundleClassLoaderAccessor$BundleClassLoader@1a9e6fe [INFO] [talledLocalContainer] java.lang.ClassCastException: org.apache.xalan.processor.TransformerFactoryImpl cannot be cast to javax.xml.transform.TransformerFactory [INFO] [talledLocalContainer] at javax.xml.transform.TransformerFactory.newInstance(Unknown Source) [INFO] [talledLocalContainer] at com.gehis.jira.plugins.PDFHandler.createPDFFile(PDFHandler.java:72)
When i exclude xml-apis it seams that my plugin has no access to the xml-apis-1.3.04.jar, which is shipped with JIRA. After excluding xml-apis in my pom the following error occurs:
java.lang.NoClassDefFoundError: org/w3c/dom/DOMImplementation at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1829)
Maybe there is also a magic hint for me? Thanks for any help!
Regards,
Markus
Community moderators have prevented the ability to post new answers.
I have found this blog post, which describes which FOP-Version to use and which exclusions to make:
https://www.clearvision-cm.com/blog/create-pdf-reports-in-jira/
It is working that way, but you can only use FOP Version 0.94. I have not found a solution to use a newer Version (maybe 2.0?).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No one here, how can help? We got the same error and struggle with it. Seems, that fop uses an old xalan version that uses old xml-apis...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi did you find the magic hint? I have the same problem with a similar ClassCast Exception:
java.lang.ClassCastException: com.icl.saxon.TransformerFactoryImpl cannot be cast to javax.xml.transform.TransformerFactory
xslt it self works grate without any change in the pom. But if I try to add the org.apache.xmlgraphics stuff it crashes.
thanks,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.