users@jaxb.java.net

InvocationTargetException when trying to create modelGroupBinding

From: Han Ming Ong <hanming_at_mac.com>
Date: Tue, 18 Mar 2003 19:12:36 -0800

Hi JAXB-gurus,

   I searched the archive. Not there, hence I'm reporting here.

parsing a schema...
compiling a schema...
java.lang.reflect.InvocationTargetException:
java.lang.IllegalStateException: Variable already initialized
         at com.sun.codemodel.JVar.init(JVar.java:71)
         at
com.sun.tools.xjc.generator.field.AbstractListFieldRenderer.getOnSetEven
tHandler(AbstractListFieldRenderer.java:106)
         at
com.sun.tools.xjc.generator.SkeletonGenerator.generateChoiceContentField
(SkeletonGenerator.java:238)
         at
com.sun.tools.xjc.generator.SkeletonGenerator.<init>(SkeletonGenerator.j
ava:130)
         at
com.sun.tools.xjc.generator.SkeletonGenerator.generate(SkeletonGenerator
.java:92)
         at com.sun.tools.xjc.Driver.generateCode(Driver.java:728)
         at com.sun.tools.xjc.Driver.run(Driver.java:423)
         at com.sun.tools.xjc.Driver._main(Driver.java:113)
         at com.sun.tools.xjc.Driver.access$000(Driver.java:77)
         at com.sun.tools.xjc.Driver$1.run(Driver.java:93)

   So what causes this?

   I have part of the schema segment:

   <xs:annotation>
     <xs:appinfo>
       <jxb:globalBindings
         collectionType="indexed"
         bindingStyle="modelGroupBinding"/>

       <jxb:schemaBindings>
         <jxb:package name="com.test"/>
       </jxb:schemaBindings>
     </xs:appinfo>
   </xs:annotation>

     <xs:element name="Foo">
     <xs:complexType>
       <xs:sequence>
         <xs:element name="comment" type="xs:string" minOccurs="0"
maxOccurs="unbounded"/>
         <xs:group ref="Bar" maxOccurs="unbounded" />
       </xs:sequence>
     </xs:complexType>
   </xs:element>

   <xs:group name="Bar">
     <xs:choice>
             <xs:element name="A" type="xs:string"/>
           <xs:element name="B" type="xs:string"/>
           <xs:element name="C" type="xs:string"/>
     </xs:choice>
   </xs:group>

If I have a simple schema file that just includes the segment above, it
will *not* have the exception.

The exception occurs when the segment is part of a much larger schema
file, which unfortunately I'm not in the liberty to reveal here :-(.
Maybe you can insert it into any big schema file that you have (and
turn on modelGroupBinding style) and perhaps you will see the exception.

Back to more immediate goal: how should I work around this? split into
multiple smaller schemas?

thanks much.

Mac OS X, 10.2.4 JDK 1.3.1