开发者

Debugging JAXB issues

开发者 https://www.devze.com 2023-02-10 00:44 出处:网络
I am running into an issue with JAXB 2 when marshaling my objects. I have an XmlJavaTypeAdapter which is working perfectly fine in unit tests, but when I try to marshal the same object graph from a we

I am running into an issue with JAXB 2 when marshaling my objects. I have an XmlJavaTypeAdapter which is working perfectly fine in unit tests, but when I try to marshal the same object graph from a web service (using JAX-WS), the XmlJavaTypeAdapter is being ignored completely. What's the easiest way to debug this problem?

I have a simple standalone project checked into my svn repository that demonstrates this issue. Can somebody please take a 开发者_开发问答look to see if I am doing something obviously wrong? The URL for the project is: http://archfirst.googlecode.com/svn/trunk/java/examples/jaxb-jaxws-sample. There is a readme.txt file in the root folder that describes the issue in detail.

Thanks.


Ok, I finally found the problem. My unit test was picking up the JAXB implementation in the Java runtime, whereas my web service was picking up the JAXB implementation from GlassFish. Apparently the implementation bundled with GlassFish (2.2.1.1) cannot handle my use case. I proved it by forcing my unit test to use jaxb-impl-2.2.1.1.jar. Also it seems that the bug has been fixed in the latest JAXB implementation (2.2.3-1), but I am struggling to figure out how to replace GlassFish's implementation with this new version (see my post here).

0

精彩评论

暂无评论...
验证码 换一张
取 消