I created a cocoon2-2 block last week and everything seemed to work just fine using "mvn jetty:run". However, when deploying the complete war on tomcat I got following stacktrace:
java.lang.IllegalArgumentException: Unknown type of result: class javax.xml.transform.dom.DOMResult net.sf.saxon.event.SerializerFactory.getReceiver(SerializerFactory.java:154)
Googling around a bit I found out I needed to rename the saxon-8.7.jar to zsaxon-8.7.jar so this jar will be loaded last.
Explanation:
The problem happens because the saxon.jar contains API classes related to DOM Level 2. The xml-apis.jar contains API for DOM Level 3. Cocoon 2.1.8 was shipped with xerces 2.7.1 and xalan 2.7.0. Both needs DOM Level 3. Hence if in the classpath the saxon.jar is first, we get DOM Level 2 related classes and you got the problem as you showed up.
After upgrading to maven3 the above workaround did not work anymore so I advise you to use below approach and add a systemproperty to the maven-surefire-plugin
Could you please show how to add the system property
ReplyDeleteThe question is a bit vague to me. Above i show you how it's done using a maven plugin. The tag systemPropertyVariables contains key-value pairs. So this means you should view this as a property called "org.apache.cocoon.mode" gets the value "dev".
Delete