I had a strange problem while trying to run the maven build, which uses the jaxb2 plugin to execute the JAXB codegen (see stacktrace table below). The best I can understand is that there is some implementation of the DTMManager, which is a class loaded from a different JAR than the one that is in xalan-2.7.1; however, I checked that the path to the class that is used to run jaxb: generate the target has only one xalan-2.7.1.jar that contains the DTMManager or DTMManagerDefault, so I donโt know what else could be in the way.
One data endpoint: our assembly defines a snapshot profile that really only serves JAR sources (using the maven-source-plugin) and publishes them as artifacts. The failure scenario described above only occurs when this profile is specified in addition to the default.
I am using Maven 2.2.1, running on Sun 64-bit JDK 1.6.0_21 on Linux x64 (Fedora 13) - see the stack below for information on "mvn -v".
Any ideas on what might be the problem and / or how to debug it? This has caused me grief over the past few days, and now it blocks progress :(
java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMManagerDefault cannot be cast to org.apache.xml.dtm.DTMManager at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:137) at org.apache.xpath.XPathContext.<init>(XPathContext.java:102) at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:207) at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:281) at com.sun.tools.xjc.reader.internalizer.Internalizer.buildTargetNodeMap(Internalizer.java:224) at com.sun.tools.xjc.reader.internalizer.Internalizer.buildTargetNodeMap(Internalizer.java:289) at com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:134) at com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:96) at com.sun.tools.xjc.reader.internalizer.DOMForest.transform(DOMForest.java:448) at com.sun.tools.xjc.ModelLoader.buildDOMForest(ModelLoader.java:342) at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:374) at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:167) at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:113) at org.jvnet.jaxb2.maven2.XJC2Mojo.runXJC(XJC2Mojo.java:1119) at org.jvnet.jaxb2.maven2.XJC2Mojo.execute(XJC2Mojo.java:720) ...
mvn -v:
# mvn -v Apache Maven 2.2.1 (r801777; 2009-08-06 14:16:01-0500) Java version: 1.6.0_21 Java home: /usr/java/jdk1.6.0_21/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux" version: "2.6.33.3-85.fc13.x86_64" arch: "amd64" Family: "unix"
java maven-2 jaxb2 classcastexception
Sankalp
source share