MOXy - 使用自包含类引导JAXBContext时的StackOverflowError [英] MOXy - StackOverflowError when bootstrapping JAXBContext with a self-containing class

查看:128
本文介绍了MOXy - 使用自包含类引导JAXBContext时的StackOverflowError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用EclipseLink MOXy JAXB实现来解组一些XML数据。我有以下带注释的类,它有自己类型的成员:

I'm trying to use the EclipseLink MOXy JAXB implementation to umarshal some XML data. I have the following annotated class, which has a member of its own type:

package stackoverflow.q19191209;

import javax.xml.bind.annotation.*;

@XmlRootElement(name="Item")
public class Item
{
    @XmlAttribute(name="name")
    @XmlID
    private String m_name;

    @XmlAttribute(name="parent")
    @XmlIDREF 
    private Item m_parent;
}

此类列在jaxb.in​​dex中。当我尝试引导我的JAXBContext时:

This class is listed in jaxb.index. When I attempt to bootstrap my JAXBContext:

JAXBContext context = JAXBContext.newInstance("stackoverflow.q19191209");       

它会挂起一秒钟,然后给我一个StackOverflowError:

it hangs for a second, and then gives me a StackOverflowError:

Exception in thread "main" java.lang.StackOverflowError
    at java.util.HashMap$ValueIterator.<init>(HashMap.java:820)
    at java.util.HashMap$ValueIterator.<init>(HashMap.java:820)
    at java.util.HashMap.newValueIterator(HashMap.java:843)
    at java.util.HashMap$Values.iterator(HashMap.java:910)
    at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.hasTextMapping(AnnotationsProcessor.java:3998)
    at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.hasTextMapping(AnnotationsProcessor.java:4003)
    at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.hasTextMapping(AnnotationsProcessor.java:4003)
...

当我使用默认的JAXB提供程序时,它不会发生 - 它正确地解组,并且所有关系都已正确建立。这是一个MOXy错误吗?

This does not happen when I use the default JAXB provider - it unmarshals correctly, and all relationships are correctly established. Is this a MOXy bug?

我尝试过JDK 1.6.0_25和JDK 1.7.0_21,以及MOXy版本2.5.0,2.5.1和2.6.0 - 结果相同。

I've tried JDK 1.6.0_25 and JDK 1.7.0_21, and MOXy versions 2.5.0, 2.5.1, and 2.6.0 - same results.

谢谢!
Steve

Thanks! Steve

推荐答案

注意:我是 EclipseLink JAXB(MOXy) 领导和 JAXB(JSR-222) 专家组。

Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group.

已将此问题的修复程序检入EclipseLink 2.5.2和2.6.0。您可以通过以下链接从 2013年10月11日下载此修复程序的每晚版本:

A fix for this issue has been checked into EclipseLink 2.5.2 and 2.6.0. You can download a nightly build with this fix starting October 11, 2013 from the following link:

  • http://www.eclipse.org/eclipselink/downloads/nightly.php

I能够重现你所看到的问题。您可以使用以下链接来跟踪我们在此问题上的进展:

I have been able to reproduce the issue that you are seeing. You can use the following link to track our progress on this issue:

  • http://bugs.eclipse.org/418730

这篇关于MOXy - 使用自包含类引导JAXBContext时的StackOverflowError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆