Questions tagged [jaxb2-maven-plugin]

This plugin uses JAXB2 to generate Java classes from XML Schemas (and binding files) and to create XML Schemas for existing Java classes.

The Java Architecture for XML Binding (JAXB) enables translation between Java classes and XML documents. JAXB2 is specified by JSR-222.

The JAXB-2 Maven Plugin requires Maven 2+ and JDK 1.5+ and makes use of the JAXB Binding Compiler (xjc)

The plugin defines two main goals (see official documentation for more goals)

  • jaxb2:xjc - runs the xjc compiler to generate Java classes from XML Schema(s) and binding file(s)
  • jaxb2:schemagen - generates XML Schemas from JAXB annotated Java classes
173 questions
0
votes
1 answer

jaxb2-maven-plugin ignores namespace when generating xsd - Two classes have the same XML type

I am currently migrating a project from Java 8 to Java 11. The version change broke our XSD generation. We are using the org.codehaus.mojo:jaxb2-maven-plugin:2.5.0 to generate the XSD from JAXB annotated classes. But it seems to be ignoring the…
0
votes
1 answer

JAXB custom binding - Prefix must resolve to a namespace

I'm trying to generate the java classes from a WSDL using the maven-jaxb2-plugin with no success. The WSDL contains two definitions for a complextype called stringArray, so I was trying to create a custom binding so the two classes don't collide…
0
votes
0 answers

Generating code from yaml - more reliable than Swagger codegen?

(Sample) Problem: When a yaml source contains conflicting definitions, e.g. myClass and MyClass both generating into a java class MyClass with one overwriting the other, no warning or error occurs. Other similar cases can occur the same way (e.g.…
0
votes
1 answer

Jackson UnrecognizedProperyException when parsing XML

I am trying to parse an XML where I generate the DTOs using maven-jaxb2-plugin from xsd file. But I get this exception and don't know why, everything seems alright. Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:…
Dogukan Evcil
  • 313
  • 4
  • 15
0
votes
2 answers

Java XSD - using a custom collection type

My Issue I am using the jaxb2 maven plugin to convert my XSD defined objects into Java classes. My goal is to set a list type element in my XSD (such as xs:choice unbound), to LinkedList instead of using the default ArrayList type. I am using the…
E.S.
  • 2,733
  • 6
  • 36
  • 71
0
votes
1 answer

Jaxb Annox plugin : Is it possible to change annotation in objectFactory class @XmlElementDecl

Im getting 2 counts of IllegalAnnotationExceptions The element has more than one mapping. Issue after using an episode file to generate the common classes from 2 xsd files. Now I have 2 objectFactory class with mapping for same element . Im thinking…
Rons
  • 1
  • 1
0
votes
1 answer

JAXB java class generation from schema: how to get a custom XML element name (keep class name)

I have an XSD with an element - it is the XMLRootElement if that makes a difference - like this: I need to have the generated Java class have a custom XML element name while keeping the default Java class name, so…
0
votes
0 answers

org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (but works on 7th call)

I'm facing the following error: org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"URL1", local:"cdrNummer") Expected elements are <{URL2}cdrNummer>,<{URL2}meldingen>,<{URL2}akteafschrift> at…
Manan
  • 140
  • 2
  • 14
0
votes
1 answer

WSDL generated Jaxb Add namespace prefix to only root element

I am creating a soap web service using jaxb2 plugin. Hence I have generated jaxb classes from wsdl file. I have entered the sample of generated codes here. //ObjectFactory.java @XmlElementDecl(namespace = "http://xxxxx/", name =…
0
votes
1 answer

With JAXB how do we avoid JAXBElement for mixed complexType

When a complexType is marked with mixed="true" in XSD, the generated Java class produces a List with either a "String" type or a JAXBElement wrapper around the actual value. Without mixed="true", the JAXBElement is not produced and the value is…
samyem
  • 437
  • 5
  • 16
0
votes
1 answer

CodeHaus Maven JAXB2 plugin error MojoExecutionException: NoSchemasException

I am trying to build my project ,in that i got error called [ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.4:xjc (One) on project tg-tg-tems-ota-common-service: : MojoExecutionException: NoSchemasException -> [Help 1] we are…
sushma r
  • 21
  • 1
  • 3
0
votes
1 answer

XML-22103: (Fatal Error) DOMResult can not be this kind of node

I have got an error during the request to an Web-service. I used Spring boot 3.x org.codehaus.mojo jaxb2-maven-plugin
skyho
  • 1,438
  • 2
  • 20
  • 47
0
votes
1 answer

Getting Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc (default-cli)

I have an XSD file and I'm trying to generate jaxb classes for that using jaxb2-maven plugin, the problem I generate the classes running the command mvn jaxb2:xjc in command line. If I run the same command as goal in run configuration in eclipse I…
Preeti
  • 69
  • 1
  • 8
0
votes
0 answers

Not able to generate classes through JAXB maven plugin

I'm new to maven, I've a xsd file and am trying to generate JAXB classes for that but the below code is not generating any classes. Below is part of my pom.xml, after adding jaxb2-maven-plugin I did maven clean and maven install and there are no…
Preeti
  • 69
  • 1
  • 8
0
votes
0 answers

@SpringBootConfiguration, you need to use @ContextConfiguration when running mvn clean install

i generate spring project from https://start.spring.io/ and added jaxb2 to generated classes from wsdl file (soap project). https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.boot …
Miha Zoubek
  • 65
  • 10