users@jaxb2-commons.java.net

Issue using maven2 jaxb2 plugin...

From: Eric Miles <emiles_at_kronos.com>
Date: Mon, 04 Dec 2006 15:41:48 -0500

All,

I'm attempting to use jaxbcommons with my maven2 jaxb2 plugin and I am
having a bit of difficulty. When I remove the dependency to the
jaxbcommons, the jaxb2 plugin works perfectly and generates the xjc
sources appropriately. However, when I have jaxbcommons as a dependency
to this plugin (and have arguments identified to generate toString
methods), I get the following error:

[INFO] Compiling
file:/home/emiles/projects/workspace_taws/taws/src/main/resources/com/kronos/taws/services/leave/LeaveService.xsd and others
java.lang.NoSuchMethodError:
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.getFeature0(Ljava/lang/String;)Z
        at
com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfiguration.getFeature(XIncludeAwareParserConfiguration.java:278)
        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.reset(AbstractSAXParser.java:2098)
        at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:147)
        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
        at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1561)
        at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:438)
        at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:556)
        at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:523)
        at
com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl.newSchema(SchemaFactoryImpl.java:206)
        at
com.sun.tools.xjc.reader.xmlschema.parser.SchemaConstraintChecker.check(SchemaConstraintChecker.java:85)
        at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:329)
        at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:145)
        at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:91)
        at com.sun.tools.xjc.XJC2Task._doXJC(XJC2Task.java:450)
        at com.sun.tools.xjc.XJC2Task.doXJC(XJC2Task.java:397)
        at com.sun.tools.xjc.XJC2Task.execute(XJC2Task.java:332)
        at com.sun.tools.xjc.maven2.XJCMojo.execute(XJCMojo.java:310)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
        at
org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:441)
        at
org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:382)
        at org.maven.ide.eclipse.Maven2Executor.main(Maven2Executor.java:68)

Now I understand why a NoSuchMethodError can be thrown, now I'm just
trying to determine WHY? When inspecting the offending class in JDK
1.5.0_09 and JDK 1.5.0_10, neither have the getFeature0 method
identified. What version of the JDK is this method available on for the
com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfiguration class?

Here is an excerpt from my pom.xml for reference:
                        <plugin>
                                <groupId>com.sun.tools.xjc.maven2</groupId>
                                <artifactId>maven-jaxb-plugin</artifactId>
                                <configuration>
                                        <includeSchemas>
                                                <includeSchema>**/*.xsd</includeSchema>
                                        </includeSchemas>
                                        <args>XtoString</args>
                                        <verbose>true</verbose>
                                </configuration>
                                <dependencies>
                                        <dependency>
                                                <groupId>org.jvnet.jaxbcommons</groupId>
                                                <artifactId>jaxbcommons-core</artifactId>
                                                <version>1.0.3</version>
                                        </dependency>
                                </dependencies>
                                <executions>
                                        <execution>
                                                <goals>
                                                        <goal>generate</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>

Just an FYI, I've tried both the com.sun.tools.xjc.maven2 and the
org.jvnet.jaxb2.maven2 JAXB2 Maven2 plugins and I receive the same
result with both.

Thanks all,
Eric Miles