jaxb

MOXy XMLCompositeCollectionMapping descriptor is missing

柔情痞子 提交于 2020-01-05 07:01:12
问题 docx4j (which I host) is typically used with the Sun/Oracle JAXB implementation; the classes of interest below were generated using XJC. I thought I'd try EclipseLink MOXy, to see how it went. On context init, I get the following error: ERROR org.docx4j.jaxb.Context .<clinit> line 107 - Cannot initialize context javax.xml.bind.JAXBException: Descriptor Exceptions: --------------------------------------------------------- Exception [EclipseLink-110] (Eclipse Persistence Services - 2.3.2

Spring Data entityManagerFactory NoClassDefFoundError

ⅰ亾dé卋堺 提交于 2020-01-05 04:00:08
问题 I've created a new Spring REST API with Spring Initializr and added JPA, Lombok, PostgreSQL and Spring Web. Sadly I get the following error on startup: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException at

Jax ws- xs:date format validation

大城市里の小女人 提交于 2020-01-04 19:04:10
问题 I have this in my XSD (please check code below): <xs:element name="Report_Date" type="xs:date" minOccurs="0"/> it is true that this field accepts only the date format yyyy-mm-dd and if any other format is given, JAXB unmarshalls it as null. But i want to validate the report_date field for incorrect format given in the request. Since this is an optional field, the application behaves same for even when the date not given and when the date is given in incorrect format. To make it simple, i want

Does the Xml Schema spec define the serialization of optional attributes with a default?

杀马特。学长 韩版系。学妹 提交于 2020-01-04 13:44:21
问题 Firstly, the Xml Schema spec does specify the parsing of an optional attribute with a default value : if such an attribute is absent in an xml document, then when parsed with the XSD, they appear to be present, and having that default value. Secondly, some tools apply this idea to serialization , so that attributes with default values are omitted (in other words: given an optional attribute with a default value , when an attribute has that value, it is omitted). However, as far as I can tell,

HibernateException: Unable to resolve entity name from Class [java.lang.Boolean] expected instance/subclass of

喜欢而已 提交于 2020-01-04 09:06:55
问题 I have an entity that represents the root element of a large xml file that was unmarshalled from xml to java using jaxb . I am trying to persist it using hibernate EntityManager.persist(elementname) , but it is throwing a HibernateException . The exception message simply states that it cannot cast a Boolean value as a specific object type. Here is the code that is throwing the error at the line persist(cd) : public Long saveToDatabase(ClinicalDocument cd){ Long id = null; try{ final

CXF/JAXB Code-first service: modify XMLSchemaType of inputs

纵然是瞬间 提交于 2020-01-04 07:52:07
问题 I am working on a CXF/JAXB code-first web service. I would like to be able to modify the WSDL definitions of some of the inputs. For example, given the following interface snippet: @WebMethod public void Something(@WebParam(name="date") Date date); The WSDL will generate the XMLSchema for the input "date" to be a "datetime" xml element. I would like it to be simply a "date" element instead. It would also be nice to be able to specify the some of the other input attributes, such as minOccurs,

Moxy is marshalling unmapped java properties

落爺英雄遲暮 提交于 2020-01-04 07:25:07
问题 I was able to use the XML as external meta-data by following the article here. However, Moxy is marshalling the properties that are neither annotated nor specified in the external XML meta-data. Below is the e.g. How to avoid this behavior? I tried using xml-mapping-metadata-complete="true" but it didn't help. Class with new prefix property added (removed other properties for brevity) public class Customer { private String prefix; public void setPrefix(String prefix) { this.prefix = prefix; }

JAXB Make QName in Objectfactory accessible

风格不统一 提交于 2020-01-04 06:10:58
问题 When you generate java classes with JAXB you'll always get a Class named ObjectFactory. In this class there is a private attribute QName with the namespace in it. Is it possible to tell the generator to make this attribute accessible from the outside. So maybe make it public or create a getter for it? 回答1: I believe those private static QName fields are only generated if the ObjectFactory needs methods that create JAXBElement<...> instances. If you call one of those methods to get a

XSD for XMI 2.1.1

余生颓废 提交于 2020-01-04 05:13:45
问题 I have to parse a XMI file (xmi version 2.1.1) using JAXB. For that, I have to generate Java classes corresponding to a XMI file. So I need a shema definition of a xmi file to do that with the jxc tool. I hope anyone know where I can find this file. Thanks in advance for help ! Edit : for more informations, there is an exemple of a xmi file (generated using modelio) : <?xml version="1.0" encoding="UTF-8"?> <uml:Model xmlns:uml="http://schema.omg.org/spec/UML/2.1.1" xmlns:xmi="http://schema

Specifying the MOXy runtime for multiple Java packages

人盡茶涼 提交于 2020-01-04 04:37:27
问题 Is there a way to specify MOXy as my JAXB implementation, for domain classes spread across multiple Java packages, other than putting jaxb.properties into every single package? 回答1: To specify EclipseLink MOXy as the JAXB provider you need to put a jaxb.properties in one of the packages for your domain objects, that is passed in to bootstrap the JAXBContext. For example if your JAXBContext will be based on the following 2 classes: example.foo.Foo example.bar.Bar example.foo.Foo package