Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7404947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:19:46+00:00 2026-05-29T05:19:46+00:00

I have a modular project in which, for every single module, I use jaxb2-maven-plugin

  • 0

I have a modular project in which, for every single module, I use jaxb2-maven-plugin to compile XSD files with xjc. Now, suppose the modules are compiled in the order A–>B. For A everything works fine (i.e. I get the *XsdImpl.java), but for B I get the following:

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.2:xjc (model) on project B: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.2:xjc (model) on project B: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.
        at org.codehaus.mojo.jaxb2.XjcMojo.execute(XjcMojo.java:352)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: org.apache.xerces.impl.dv.DVFactoryException: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.
        at org.apache.xerces.impl.dv.DTDDVFactory.getInstance(Unknown Source)
        at org.apache.xerces.impl.dv.DTDDVFactory.getInstance(Unknown Source)
        at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.<init>(Unknown Source)
        at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.<init>(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.<init>(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.<init>(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaLoader.<init>(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaLoader.<init>(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.<init>(Unknown Source)
        at org.apache.xerces.jaxp.validation.XMLSchemaValidatorComponentManager.<init>(Unknown Source)
        at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.<init>(Unknown Source)
        at org.apache.xerces.jaxp.validation.AbstractXMLSchema.newValidatorHandler(Unknown Source)
        at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:47)
        at com.sun.tools.xjc.reader.xmlschema.bindinfo.AnnotationParserFactoryImpl$1$1.startElement(AnnotationParserFactoryImpl.java:136)
        at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.startElement(NGCCRuntime.java:214)
        at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
        at com.sun.tools.xjc.reader.ExtensionBindingChecker.startElement(ExtensionBindingChecker.java:271)
        at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
        at com.sun.tools.xjc.reader.xmlschema.parser.IncorrectNamespaceURIChecker.startElement(IncorrectNamespaceURIChecker.java:97)
        at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
        at com.sun.tools.xjc.reader.xmlschema.parser.CustomizationContextChecker.startElement(CustomizationContextChecker.java:172)
        at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
        at com.sun.tools.xjc.ModelLoader$SpeculationChecker.startElement(ModelLoader.java:427)
        at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
        at com.sun.tools.xjc.reader.internalizer.VersionChecker.startElement(VersionChecker.java:78)
        at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
        at com.sun.xml.xsom.parser.JAXPParser.parse(JAXPParser.java:79)
        at com.sun.tools.xjc.ModelLoader$2.parse(ModelLoader.java:451)
        at com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:237)
        at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:298)
        at com.sun.xml.xsom.impl.parser.ParserContext.parse(ParserContext.java:87)
        at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:147)
        at com.sun.tools.xjc.ModelLoader.createXSOMSpeculative(ModelLoader.java:468)
        at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:338)
        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.Driver.run(Driver.java:287)
        at org.codehaus.mojo.jaxb2.XjcMojo.execute(XjcMojo.java:301)
        ... 21 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Both the modules use the same configuration for the plugin:

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>model</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>

                        <configuration>
                            <extension>true</extension>
                            <clearOutputDir>false</clearOutputDir>
                            <bindingDirectory>${basedir}/src/main/resources/xsd</bindingDirectory>

                            <outputDirectory>${basedir}/src/main/generated</outputDirectory>
                            <schemaDirectory>${basedir}/src/main/generated/xsd</schemaDirectory>

                            <schemaFiles>base.xsd</schemaFiles>
                            <staleFile>${project.build.directory}/generated-sources/jaxb/.staleFlag-model</staleFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

The error comes always for the second module (it doesn’t matter whether A or B).
I’ve spent a lot of time trying to figure out what happens behind the scenes but unfortunately without success…
For example, I would like to understand what happens upon the first execution here:

    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
   --->>> at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)

I would guess another class is used instead of org.apache.xerces.jaxp.SAXParserImpl, but somehow org.apache.xerces.jaxp.SAXParserImpl is selected the 2nd time.. Do you know how could I proof this? Or did anybody experience the same issue already?

Thanks in advance a lot for any hint/help!
Bye

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:19:47+00:00Added an answer on May 29, 2026 at 5:19 am

    The issue is that you have inadvertently provided a JAXP implementation without the JAXP API, that is incompatible with the JAXP API that is bundled with the JRE.

    To solve this issue, I added JAXP API + implementation dependencies to all jaxb2 plugins in my project:

                </executions>
                <dependencies>
                    <dependency>
                        <groupId>xml-apis</groupId>
                        <artifactId>xml-apis</artifactId>
                        <version>1.3.04</version>
                    </dependency>
                    <dependency>
                        <groupId>xerces</groupId>
                        <artifactId>xercesImpl</artifactId>
                        <version>2.9.1</version>
                    </dependency>
                </dependencies>
            </plugin>
    

    Remember to update all jaxb2 plugins, not just the failing one. This is because plugin dependencies are resolved only once when the plugin is executed for the first time. This may or may not be the module where the failure occurs.

    == EDIT ==

    Keep in mind that since Java 1.6, all the necessary JAXP, JAXB, xerces, xalan, JAX-WS RI, SAAJ and related classes are bundled in the JRE library.

    You do not need to include any of these deps in your project, unless you’re building with an archaic JDK (1.5 or older).

    So, if you remove JAXB dependencies from your POM (and maybe upgrade to the latest jaxb2-maven-plugin), your build will probably work fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP MySQL application which has a modular design. There are about
I have a modular Dynamic Web Project in Eclipse. When I try to publish
I have a Netbeans Platform modular project, not a regular Java project. I want
In my solution, I have one application project, which defines all the resources -
I am have modular structure in my project --application ----modules -----admin ------models -----client ------models
For my upcoming university C project, I'm requested to have modular code as C
If you have a modular applicaiton that depends on its modules to be in
Have just started using Visual Studio Professional's built-in unit testing features, which as I
We have the beginnings of a modular wpf application built using prism. We want
I'm trying to have a modular uiview that will be placed on top of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.