jibx:缺少必需的对象异常

时间:2011-09-08 09:52:51

标签: java xml jibx

我正在使用JiBX来编组一些类。它运作良好,直到我得到IllegalStateException

java.lang.IllegalStateException: Missing required object
at org.jibx.runtime.impl.MarshallingContext.pushObject(MarshallingContext.java:1181)
at com.dreipplus.profiler.importer.binding.trans.JiBX_binding0MungeAdapter.JiBX_binding0_marshalAttr_1_18()
at com.dreipplus.profiler.importer.binding.trans.JiBX_binding0RoomProductVO_access.marshal()
at com.dreipplus.profiler.importer.binding.trans.LibRoomObjectImport.JiBX_binding0_marshal_3_0(LibRoomObjectImport.java)
at com.dreipplus.profiler.importer.binding.trans.JiBX_binding0LibRoomObjectImport_access.marshal()
at com.dreipplus.profiler.importer.binding.trans.LibRoomObjectImport.marshal(LibRoomObjectImport.java)
at com.dreipplus.profiler.importer.binding.trans.JiBX_binding0MungeAdapter.JiBX_binding0_marshal_1_3()
at com.dreipplus.profiler.importer.binding.trans.LibraryImport.JiBX_binding0_marshal_2_0(LibraryImport.java)
at com.dreipplus.profiler.importer.binding.trans.JiBX_binding0LibraryImport_access.marshal()
at com.dreipplus.profiler.importer.binding.trans.LibraryImport.marshal(LibraryImport.java)
at com.dreipplus.profiler.importer.binding.trans.JiBX_binding0MungeAdapter.JiBX_binding0_marshal_1_0()
at com.dreipplus.profiler.importer.binding.trans.Libraries.JiBX_binding0_marshal_2_0(Libraries.java)
at com.dreipplus.profiler.importer.binding.trans.JiBX_binding0Libraries_access.marshal()
at com.dreipplus.profiler.importer.binding.trans.Libraries.marshal(Libraries.java)
at org.jibx.runtime.impl.MarshallingContext.marshalRoot(MarshallingContext.java:1021)
at org.jibx.runtime.impl.MarshallingContext.marshalDocument(MarshallingContext.java:1083)
at com.dreipplus.profiler.library.LibraryTest.testExportLibrary(LibraryTest.java:186)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:70)

xml输出停在另一个(更远)位置(也许它没有被刷新):

...         
<objectsmaterial>
            <material>
                <name>
                    <localizedtext size="1">
                        <entry key="de_AT">Furnier Kanadische Ahorn</entry>
                    </localizedtext>
                </name>
                <longtext>
                    <localizedtext size="1">
                        <entry key="de_AT">
[EOF]

usage="optional"未设置是否存在问题? JiBX期待一个领域不存在吗?我在JiBX上缺少调试输出,但这已经被报告为他们的JIRA中的错误。

如果有人知道什么是错的,或者我怎么能弄清楚什么是错的,拜托!

这是我的binding0.xml binding0.xml pastebin

提前致谢

Florian Huber

1 个答案:

答案 0 :(得分:5)

如果字段为空,则IllegalArgumentException会出现,如果它有(XML-)Subelements。

我仔细检查了代码,发现了这个错误。