On Wed, Nov 25, 2009 at 2:26 PM, Pavel Bucek <Pavel.Bucek_at_sun.com> wrote:
>
> Hello,
>
> already explained in the issue comment.. see
> https://jaxb.dev.java.net/issues/show_bug.cgi?id=721.
>
> there is a simple reason
Ha!
> and a simple way how to get this working:
>
> reason: you are using jaxb-api v2.1 from jdk 1.6
> needed action: copy jaxb-api.jar (v2.2!) to jdk's endorsed dir
Which, to save you the bother of googling, is
$JAVA_HOME/jre/lib/endorsed/, needing to be created.
FYI, I have also urged for clarifying info in JAXB's docs/ReleaseNotes.html
-W
>
> regards,
> Pavel
>
>
> Wolfgang Laun wrote:
>>
>> John,
>>
>> the schema with 0/unboudned compiles without a hitch with any regular
>> xjc from JAXB v 2.1.8 up to 2.1.11 and the one distributed with JDK
>> "1.6.0_0". It fails with xjc JAXB 2.2 "Early Access". I'll submit an
>> issue.
>>
>> -W
>>
>>
>> On Tue, Nov 24, 2009 at 7:45 PM, John Leonard <jleonard.20081_at_gmx.com>
>> wrote:
>>
>>>
>>> Wolfgang Laun wrote:
>>>
>>>>
>>>> This does not depend on <choice...> alone. Can you post a full .xsd
>>>> producing the exception?
>>>> -W
>>>>
>>>> On 11/22/09, John Leonard <jleonard.20081_at_gmx.com> wrote:
>>>>
>>>>
>>>>>
>>>>> Does JAXB understand the following use of the "choice" element?
>>>>>
>>>>> <choice minOccurs="0" maxOccurs="unbounded">
>>>>> <element...
>>>>> <element...
>>>>> ...
>>>>> </choice>
>>>>>
>>>>> Here is the output of XJC when I run it from the command line on a file
>>>>> containing such code:
>>>>> parsing a schema...
>>>>> compiling a schema...
>>>>> [INFO] generating code
>>>>> unknown location
>>>>>
>>>>> Exception in thread "main"
>>>>> java.lang.reflect.UndeclaredThrowableException
>>>>> at $Proxy7.required(Unknown Source)
>>>>> at
>>>>> com.sun.tools.xjc.generator.bean.field.AbstractField.annotateReferenc
>>>>> e(AbstractField.java:197)
>>>>> at
>>>>> com.sun.tools.xjc.generator.bean.field.AbstractField.annotate(Abstrac
>>>>> tField.java:156)
>>>>> at
>>>>> com.sun.tools.xjc.generator.bean.field.AbstractListField.generate(Abs
>>>>> tractListField.java:124)
>>>>> at
>>>>> com.sun.tools.xjc.generator.bean.field.UntypedListField.<init>(Untype
>>>>> dListField.java:107)
>>>>> at
>>>>> com.sun.tools.xjc.generator.bean.field.UntypedListFieldRenderer.gener
>>>>> ate(UntypedListFieldRenderer.java:72)
>>>>> at
>>>>> com.sun.tools.xjc.generator.bean.field.DefaultFieldRenderer.generate(
>>>>> DefaultFieldRenderer.java:79)
>>>>> at
>>>>> com.sun.tools.xjc.generator.bean.BeanGenerator.generateFieldDecl(Bean
>>>>> Generator.java:747)
>>>>> at
>>>>> com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassBody(Bean
>>>>> Generator.java:535)
>>>>> at
>>>>> com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.j
>>>>> ava:235)
>>>>> at
>>>>> com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator
>>>>> .java:175)
>>>>> at com.sun.tools.xjc.model.Model.generateCode(Model.java:286)
>>>>> at com.sun.tools.xjc.Driver.run(Driver.java:343)
>>>>> at com.sun.tools.xjc.Driver.run(Driver.java:191)
>>>>> at com.sun.tools.xjc.Driver._main(Driver.java:116)
>>>>> at com.sun.tools.xjc.Driver.access$000(Driver.java:74)
>>>>> at com.sun.tools.xjc.Driver$1.run(Driver.java:96)
>>>>> Caused by: java.lang.NoSuchMethodException:
>>>>> javax.xml.bind.annotation.XmlElement
>>>>> Ref.required()
>>>>> at java.lang.Class.getDeclaredMethod(Unknown Source)
>>>>> at
>>>>> com.sun.codemodel.TypedAnnotationWriter.invoke(TypedAnnotationWriter.
>>>>> java:107)
>>>>> ... 17 more
>>>>>
>>>>> Thanks,
>>>>> John L.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>>>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>>>
>>>>
>>>
>>> File "xjc_compiles.xsd":
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <schema
>>> xmlns="http://www.w3.org/2001/XMLSchema"
>>> targetNamespace="http://www.sudokucaptain.com/CommandString111609"
>>> xmlns:cs="http://www.sudokucaptain.com/CommandString111609">
>>>
>>> <element name="TestElement">
>>> <complexType>
>>> <choice>
>>> <element name="element1" />
>>> <element name="element2" />
>>> </choice>
>>> </complexType>
>>> </element>
>>>
>>> </schema>
>>>
>>> File "xjc_doesnt_compile.xsd":
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <schema
>>> xmlns="http://www.w3.org/2001/XMLSchema"
>>> targetNamespace="http://www.sudokucaptain.com/CommandString111609"
>>> xmlns:cs="http://www.sudokucaptain.com/CommandString111609">
>>>
>>> <element name="TestElement">
>>> <complexType>
>>> <choice minOccurs="0" maxOccurs="unbounded">
>>> <element name="element1" />
>>> <element name="element2" />
>>> </choice>
>>> </complexType>
>>> </element>
>>>
>>> </schema>
>>>
>>> The only difference between these two files is this line:
>>> <choice minOccurs="0" maxOccurs="unbounded">
>>>
>>> I think JAXB would have a hard time working with a List containing
>>> unrelated
>>> types. Their only common ancestor would be "Object". It would still be
>>> nice,
>>> however, if this could be done as it would offer an alternative to
>>> creating
>>> large groups of related types and substitution groups.
>>>
>>> John L.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>