Thanks so much Jean-François. I had taken that example from another site – where they used the both JAXBElement as well as dom.Element – to add the attribute to the label. Is there another way to accomplish something like this? Since this is only marshaling my Java objects, I have a lot of flexibility on how I structure my class.
<DISTILLED_WATER label="Distilled Water">Deer Park</DISTILLED_WATER> <MINERAL_WATER label="Mineral Water">Mountain Stream</MINERAL_WATER> <PURIFIED_WATER label="Mineral Water">Mr. Water</PURIFIED_WATER> From: Jean-François HEROUARD <jfherouard.alme...@gmail.com> Date: Tuesday, February 4, 2014 4:25 AM To: Shawn Johnson <johnson_sh...@bah.com> Cc: "resteasy-users@lists.sourceforge.net" <resteasy-users@lists.sourceforge.net> Subject: [External] Re: [Resteasy-users] Error marshaling w/ XmlAnyElement + Element Adapter - simple JBoss 7 + RESTEasy project I've tested with JAXB 2.2.5, it's the same problem, so forget my previous mail. With the following method in LabelValueAdapter, there's no more NPE : @Override public Element marshal(LabelValue labelValueModel) throws Exception { Element e = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument().cre ateElement(getCleanLabel(labelValueModel.getLabel())); e.setTextContent(labelValueModel.getValue()); return e; } With this result : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <testModel> <DISTILLED_WATER>Deer Park</DISTILLED_WATER> <MINERAL_WATER>Mountain Stream</MINERAL_WATER> <PURIFIED_WATER>Mr. Water</PURIFIED_WATER> </testModel> I have removed all adapter class private attributes and usage JAXBElement, it seems there is a problem calling a JAXB marshaller inside an adapter. JAXB marshalling is not "reentrant" ? 2014-02-04 Jean-François HEROUARD <jfherouard.alme...@gmail.com>: I had a similar problem, but the stacktrace was not exactly the same. This NPE sounds like a jaxb-impl bug of 2.2.4 version, see https://jaxb.java.net/2.2.6/docs/ch02.html. Version 2.2.4 is embedded by JBoss7.1.x, you should replace jaxb-impl with 2.2.5. Can you also check in your "crazy class path" project what is your version af jaxb-impl ? I'll try to find time to check out and run your project. 2014-02-03 Johnson, Shawn [USA] <johnson_sh...@bah.com>: Bill, thanks for the reply. Sorry for leaving out the version info partially because I've tried 3 different configs. Below is the stack trace from JBoss AS 7.2 which I left with it's included version of RESTEasy 2.3.5. I can also repeat this with 3.0.6 if that's more helpful? [Previous message was too long for the mailing list] Here is a link to the full stack trace using RESTEasy 2.3.5. http://pastebin.com/eFiBgfYQ Re: [Resteasy-users] Error marshaling w/ XmlAnyElement + Element Adapter - simple JBoss 7 + RESTEasy project From: Bill Burke <bburke@re...> - 2014-02-03 15:19 You'll have to point out what resteasy version you are using so I can match the line numbers in you stack trace up. --------------------------------------------------------------------------- --- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktr k _______________________________________________ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users