Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NPE when using xjc  RSS feed

 
Robert Hulme
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am trying to compile the standard cxml InvoiceDetail.dtd using the xjc compiler. However, it throws a NullPointerException. This is the standard dtd that is found on the cxml website at http://www.cxml.org/

C:\Program Files\Java\jdk1.6.0_27\bin>xjc -dtd -nv \temp\InvoiceDetail.dtd
parsing a schema...
compiling a schema...
Exception in thread "main" java.lang.NullPointerException
at com.sun.tools.internal.xjc.generator.bean.field.AbstractField$1TypeLi
st.add(AbstractField.java:431)
at com.sun.tools.internal.xjc.generator.bean.field.AbstractField$1TypeLi
st.add(AbstractField.java:443)
at com.sun.tools.internal.xjc.generator.bean.field.AbstractField.getType
(AbstractField.java:447)
at com.sun.tools.internal.xjc.generator.bean.field.AbstractField.<init>(
AbstractField.java:109)
at com.sun.tools.internal.xjc.generator.bean.field.AbstractListField.<in
it>(AbstractListField.java:94)
at com.sun.tools.internal.xjc.generator.bean.field.UntypedListField.<ini
t>(UntypedListField.java:94)
at com.sun.tools.internal.xjc.generator.bean.field.UntypedListFieldRende
rer.generate(UntypedListFieldRenderer.java:61)
at com.sun.tools.internal.xjc.generator.bean.field.DefaultFieldRenderer.
generate(DefaultFieldRenderer.java:68)
at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.generateField
Decl(BeanGenerator.java:736)
at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.generateClass
Body(BeanGenerator.java:524)
at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.<init>(BeanGe
nerator.java:224)
at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.generate(Bean
Generator.java:164)
at com.sun.tools.internal.xjc.model.Model.generateCode(Model.java:275)
at com.sun.tools.internal.xjc.Driver.run(Driver.java:332)
at com.sun.tools.internal.xjc.Driver.run(Driver.java:180)
at com.sun.tools.internal.xjc.Driver._main(Driver.java:105)
at com.sun.tools.internal.xjc.Driver.access$000(Driver.java:63)
at com.sun.tools.internal.xjc.Driver$1.run(Driver.java:85)

Any help would be much appreciated.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I downloaded the InvoiceDetail.zip, extracted it, ran your command (in same folder) and get:


Try running from within c:\temp and see if you get the same error.

WP
 
Robert Hulme
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply William. I neglected to mention that I had got past those errors. I hacked the downloaded DTD to make name at line 490 be rname and SerialNumber at line 3246 be iSerialNumber to make them unique. I think you could probably avoid hacking the dtd using jaxb:property but I am not sure this is possible with a DTD. However, I have done this on a few DTD's in the past and would expect xjc to compile it at this point, rather than throw an NPE.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!