java.lang.IllegalArgumentException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • GitHub comment 608#239608389
    via GitHub by ctrimble
    ,
  • Trace: Exception in thread "main" java.lang.IllegalArgumentException: trying to create the same field twice: ts1EnbDirectInfoTransferTrir at com.sun.codemodel.JDefinedClass.field(JDefinedClass.java:421) at com.sun.codemodel.JDefinedClass.field(JDefinedClass.java:392) at com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.createField(AbstractFieldWithVar.java:77) at com.sun.tools.xjc.generator.bean.field.SingleField.<init>(SingleField.java:94) at com.sun.tools.xjc.generator.bean.field.SingleField.<init>(SingleField.java:81) at sun.reflect.GeneratedConstructorAccessor8.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.sun.tools.xjc.generator.bean.field.GenericFieldRenderer.generate(GenericFieldRenderer.java:69) at com.sun.tools.xjc.generator.bean.field.DefaultFieldRenderer.generate(DefaultFieldRenderer.java:84) at com.sun.tools.xjc.generator.bean.BeanGenerator.generateFieldDecl(BeanGenerator.java:764) at com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassBody(BeanGenerator.java:545) at com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:248) at com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:166) at com.sun.tools.xjc.model.Model.generateCode(Model.java:290) at com.sun.tools.xjc.Driver.run(Driver.java:348) at com.sun.tools.xjc.Driver.run(Driver.java:196) at com.sun.tools.xjc.Driver._main(Driver.java:121) at com.sun.tools.xjc.Driver.access$000(Driver.java:79) at com.sun.tools.xjc.Driver$1.run(Driver.java:101) In XML I have two fields with the same name, but the are in different cases, which is legal: <!-- - Name: ts1EnbDirectInfoTransferTrir - Defined in: lte.NaccTimersConf - Units: ms - Min/Max: 1 to 10000 - Default: 3000 - Access: Read-Write --> <xsd:element name="ts1EnbDirectInfoTransferTrir" minOccurs="0"> <xsd:simpleType> <xsd:restriction base="xsd:int"> <xsd:minInclusive value="1"/> <xsd:maxInclusive value="10000"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <!-- - Name: tS1EnbDirectInfoTransferTrir - Defined in: lte.NaccTimersConf - Units: ms - Min/Max: 1 to 10000 - Default: 3000 - Access: Read-Write --> <xsd:element name="tS1EnbDirectInfoTransferTrir" minOccurs="0"> <xsd:simpleType> <xsd:restriction base="xsd:int"> <xsd:minInclusive value="1"/> <xsd:maxInclusive value="10000"/> </xsd:restriction> </xsd:simpleType> </xsd:element>
    via by wargoth,
  • Try downloading all of the XML Schema files from the web page linked above and then run xjc on CDA.xsd to generate the equivalent Java code. It will fail with this error. Exception in thread "main" java.lang.IllegalArgumentException: trying to create the same field twice: id at com.sun.codemodel.JDefinedClass.field(JDefinedClass.java:419) at com.sun.codemodel.JDefinedClass.field(JDefinedClass.java:390) at com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.createField (AbstractFieldWithVar.java:71) at com.sun.tools.xjc.generator.bean.field.SingleField.<init> (SingleField.java:89) at com.sun.tools.xjc.generator.bean.field.SingleField.<init> (SingleField.java:76) at sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.sun.tools.xjc.generator.bean.field.GenericFieldRenderer.generate (GenericFieldRenderer.java:64) at com.sun.tools.xjc.generator.bean.field.DefaultFieldRenderer.generate (DefaultFieldRenderer.java:75) at com.sun.tools.xjc.generator.bean.BeanGenerator.generateFieldDecl (BeanGenerator.java:744) at com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassBody (BeanGenerator.java:532) at com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:234) at com.sun.tools.xjc.generator.bean.BeanGenerator.generate (BeanGenerator.java:174) 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) The error message is correct, but not helpful. In all other cases when there is an error in an XML Schema file, xjc reports the exact line number where the problem exists. It should also report the line number for a duplicate field name. That would have made it much easier to identify the underlying problem. (For a full description see this discussion thread: http://forums.java.net/jive/message.jspa?messageID=278722 .)
    via by nradov,
    • java.lang.IllegalArgumentException: trying to create thesame field twice: config [jwsc] at com.sun.codemodel.JDefinedClass.field(JDefinedClass.java:392)[jwsc] at com.sun.codemodel.JDefinedClass.field(JDefinedClass.java:363)[jwsc] at com.sun.tools.ws.processor.modeler.annotation.WebServiceWrapperGenerator.writeMembers(WebServiceWrapperGenerator.java:419)[jwsc] at com.sun.tools.ws.processor.modeler.annotation.WebServiceWrapperGenerator.generateWrappers(WebServiceWrapperGenerator.java:299)
    No Bugmate found.