Questions tagged [moxy]

MOXy is the object-to-XML and object-to-JSON component of EclipseLink. It is a JAXB (JSR-222) implementation with extensions for supporting: XPath based mapping, JPA entities, and infoset preservation.

MOXy is the object-to-XML and object-to-JSON component of EclipseLink. It is a JAXB (JSR-222) implementation with extensions for supporting: XPath based mapping, JPA entities, and infoset preservation.

868 questions
5
votes
2 answers

NPE Thrown Marshalling Entity in JAX-RS

I have a JAX-RS webservice that makes use of JPA entity classes. I have a resource class like this: @Path("/entity") public class MyEntityResource { @GET @Produces(MediaType.APPLICATION_XML) @Path("/{entity}") public MyEntity…
sdoca
  • 7,832
  • 23
  • 70
  • 127
5
votes
2 answers

Global Java Type Adapters in MOXy

Is it possible to define global java type adapters/converters in MOXy (up to the newest release (2.6.0)? Such adapter would be applied by default to all classes registered in jaxb context if not explicitly overridden. For instance, I would like to…
Stepan Vavra
  • 3,884
  • 5
  • 29
  • 40
5
votes
1 answer

Custom MOXyJsonProvider in Jersey 2 not working?

I was reading over the answer for Moxy ignore invalid fields in json and the approach matched something I'm trying to do, so I decided to give it a shot.. I created a feature to disable the default ConfigurableMoxyJsonProvider; @Provider public…
XeroxDucati
  • 5,130
  • 2
  • 37
  • 66
5
votes
1 answer

Customizing JSON marhsalling with GlassFish v4

We've got a JAX-RS application that runs on Apache TomEE. We slightly customize the default Jettison provider to better adhere to JSON conventions used by JavaScript frontend. TomEE allows to do it via its resources.xml file:
5
votes
2 answers

JAXBException: "package" doesnt contain ObjectFactory.class or jaxb.index

I have been playing with JAXB / MOXy a lot lately, and it works great on all my tests and example codes. I exclusively using binding files, that's why I'm using MOXy. Please note that in all my examples, I'm NEVER using an ObjectFactory nor a…
avi.elkharrat
  • 6,100
  • 6
  • 41
  • 47
5
votes
2 answers

JAXB Marshals root element without a close tag if it only has an attribute

I am using JAXB / Moxy to marshal a class into XML. When the root element only contains an attribute the output is as follows:
BenjaminDWest
  • 105
  • 1
  • 6
5
votes
0 answers

Marshalling List with MOXy
I have read many of Blaise Doughan's StackOverflow answers and blog posts, and I thought I understood his examples for using @XmlAnyElement with Object[]'s. But the same principles doesn't appear to work with List - as shown with the example below…
Mark
  • 71
  • 7
5
votes
1 answer

Using an adapter to marshal a class to a root element with MOXy or any other JAXB implementation

I have a class which extends the CompositeConfiguration class from Apache Commons Configuration. I am trying to marshal it to XML using MOXy. I have created an XML adapter that converts the configuration to a list of simple name/value objects. I…
Jonathan Byrne
  • 193
  • 1
  • 11
5
votes
1 answer

Moxy: List of objects XML and JSON can't get both look good

I have a problem getting Moxy to generate "good" XML and JSON for a list of inherited objects. Either of the XML looks find or the JSON looks fine, but not at the same time. Here is the model: public static abstract class Animal { private String…
user3099799
  • 181
  • 1
  • 6
5
votes
1 answer

Unmarshalling nested objects from JSON with JAXB

I'm trying to unmarshall input JSON into JAXB objects with Eclipselink. However, when I try to do this, I find that nested objects end up being set as null. I can try and unmarshall the nested object by itself, and it will work up until the point…
5
votes
1 answer

Moxy, JSON and Jersey 2.0 does not deserialize plain String array

In my current setup I use Jersey 2.0 with MOXy as discribed in jersey docs. I rely completely on the “Auto-Discoverable Features”, so I do not use any extra configuration or JAXB annotation. My task is to deserialize an array of strings on the…
adler
  • 949
  • 1
  • 9
  • 10
5
votes
1 answer

@XmlDiscriminatorNode/@XmlDescriminatorValue not working on WebLogic Server

Following are the classes I am using for create sub classes using MOXy JAXB conversion on WebLogic 10.3.2 version. I am using the EclipseLink 2.4.1 MOXy for generating the XML. I am unable to generate the type attribute in the following code. Let…
user1896301
  • 101
  • 1
  • 5
5
votes
1 answer

Can I get MOXy to convert a string to a boolean when generating json

The object model has an element ended of type String public class LifeSpan { protected String begin; protected String end; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String ended; .... but its actually only ever a boolean, (I dont…
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
5
votes
1 answer

JAXB wrap wrapped collections

I have a class that contain two lists. I want to generate a wrapper element around the list elements, and around the two list. class SomeClass { private List listA; private List listB; }
Come get some
  • 394
  • 3
  • 9
4
votes
1 answer

Configuring CXF with Spring to use MOXY for XML marshalling/unmarshalling

I have a Java server application that uses CXF to provide SOAP and REST web services. Currently it uses the reference implementation of JAX-B for XML marshalling/unmarshalling, but I have configured it to replace Jettison with Jackson for JSON…
Dave
  • 21,524
  • 28
  • 141
  • 221