jaxb

How to handle java.util.Date with MOXy bindings file

这一生的挚爱 提交于 2021-02-20 17:55:52
问题 i'm new to MOXy and JaxB in general and I'm facing a problem with java.util.Date conversion. I'm unmarshaling an XML file (which I have no control of) to objects using a mapping file (I can neither manually annotate existing classes nor change them). My XML mapping file looks like this : <?xml version="1.0"?> <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" version="2.1"> <java-types> <java-type name="Observation"> <xml-type prop-order="date theoricalTime ci ch cr

How to handle java.util.Date with MOXy bindings file

♀尐吖头ヾ 提交于 2021-02-20 17:54:19
问题 i'm new to MOXy and JaxB in general and I'm facing a problem with java.util.Date conversion. I'm unmarshaling an XML file (which I have no control of) to objects using a mapping file (I can neither manually annotate existing classes nor change them). My XML mapping file looks like this : <?xml version="1.0"?> <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" version="2.1"> <java-types> <java-type name="Observation"> <xml-type prop-order="date theoricalTime ci ch cr

Jaxb XSD validationevent isn't working after migration to WebLogic12

一世执手 提交于 2021-02-20 04:53:25
问题 I am trying to validate Jaxb objects against an xsd by marshalling them. This was working fine in weblogic11 but after migration to weblogic12c it isn't working. For example, even if the mandatory tags are missing, there is no error and xml is being formed successfully! I noticed event.getLinkedException() is returning null. ValidateXml.java import java.io.File; import java.io.StringWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;

How do I configure Glassfish 5 to use Moxy as the default Provider?

不问归期 提交于 2021-02-20 02:20:19
问题 I’m migrating our web application from Glassfish 3 to Glassfish 5, and during the migration I ran across this error for a request. [2019-09-17T15:57:30.732-0600] [glassfish 5.0] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=241 _ThreadName=http-listener-2(27)] [timeMillis: 1568757450732] [levelValue: 900] [[ StandardWrapperValve[ClientControllers]: Servlet.service() for servlet ClientControllers threw exception java.lang.ClassCastException: [Z cannot be cast to [Ljava.lang.Object; at

How do I configure Glassfish 5 to use Moxy as the default Provider?

不想你离开。 提交于 2021-02-20 02:20:06
问题 I’m migrating our web application from Glassfish 3 to Glassfish 5, and during the migration I ran across this error for a request. [2019-09-17T15:57:30.732-0600] [glassfish 5.0] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=241 _ThreadName=http-listener-2(27)] [timeMillis: 1568757450732] [levelValue: 900] [[ StandardWrapperValve[ClientControllers]: Servlet.service() for servlet ClientControllers threw exception java.lang.ClassCastException: [Z cannot be cast to [Ljava.lang.Object; at

JAXB issue in JDK 8

北慕城南 提交于 2021-02-20 02:13:52
问题 I am trying to unmarshall XML String payload using JAXB in jdk1.8.0_162, while trying to get JAXBContext.newInstance, I am getting javax.xml.bind.JAXBException - with linked exception:[java.lang.ClassNotFoundException: oracle.xml.jaxb.JaxbContextImpl], any input would be great! I have tried adding following dependencies in my pom.xml based on different suggestions from various stackoverflow forums, nothing seems to work : <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId>

JAXB issue in JDK 8

Deadly 提交于 2021-02-20 02:13:32
问题 I am trying to unmarshall XML String payload using JAXB in jdk1.8.0_162, while trying to get JAXBContext.newInstance, I am getting javax.xml.bind.JAXBException - with linked exception:[java.lang.ClassNotFoundException: oracle.xml.jaxb.JaxbContextImpl], any input would be great! I have tried adding following dependencies in my pom.xml based on different suggestions from various stackoverflow forums, nothing seems to work : <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId>

How can JAXB XmlAdapter be used to marshall lists?

落花浮王杯 提交于 2021-02-19 06:48:05
问题 Instances of this class are part of a large object graph and are not at the root of the object graph: public class Day { public Day(LocalDate date, List<LocalTime> times) { this.date = date; this.times = times; } public Day() { this(null, null); } public LocalDate getDate() { return date; } public List<LocalTime> getTimes() { return times; } private final LocalDate date; private final List<LocalTime> times; } The object graph is converted to JSON using Jersey and JAXB. I have XmlAdapter s

org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character (NULL, unicode 0) encountered: not valid in any content

强颜欢笑 提交于 2021-02-19 06:37:05
问题 I am using a cxf webservice which uses local transport and accessing the webservice from java application. Webservice is reading a file and sending through webservice call. I am using the byte size as 512. Suppose the file size is 1200. First two attempt of retrieving the file is success and for the last chunk i am getting org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character (NULL, unicode 0) encountered: not valid in any content. Here chunk represents 512 bytes. I am

Setting CharacterEscapeHandler variable on a Marshaller doesn't work as expected in CXF

强颜欢笑 提交于 2021-02-19 04:16:00
问题 I'm using Apache CXF to implement some WebServices at server side. I have to implement a WebService that returns a string (Holder) with some values separated by tab character. Apache CXF encodes character tab as a tab, but our client (that can not be change...) doesn't accept it and only read tabs encoded as . So I tried to simply make a replaceAll on the string to change \t for , but an escapeHandler on Marshaller changes it to &#9; . Then I tried to create a customCharacterEscapeHandler