分享

jaxb实践

 蚂蚁搬家 2009-10-12
com.sun.tools.apt.main.CommandLine.parse(CommandLine.java:42)官方解释
http://bugs./view_bug.do;jsessionid=e9d905c1f0f588ffffffffa3149dc97319886?bug_id=6510966
 
we tried to generate a XML schema out of our existing domain model by using the JAXB (2.1, JDK 1.6.0_07) schemagen.

Trying to launch the schemagen as described in the tutorial caused the following error:

  1. C:\temp>schemagen Example.java   
  2. An exception has occurred in apt (1.6.0_07). Please file a bug at the   
  3. Java Developer Connection (http://java./webapps/bugreport)   
  4. after checking the Bug Parade for duplicates. Include your program and   
  5. the following diagnostic in your report.  Thank you.   
  6. java.lang.NullPointerException   
  7.         at com.sun.tools.apt.main.CommandLine.parse(CommandLine.java:42)   
  8.         at com.sun.tools.apt.main.Main.compile(Main.java:775)   
  9.         at com.sun.tools.apt.Main.processing(Main.java:95)   
  10.         at com.sun.tools.apt.Main.process(Main.java:85)   
  11.         at com.sun.tools.apt.Main.process(Main.java:67)   
  12.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   
  13.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)   
  14.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)   
  15.         at java.lang.reflect.Method.invoke(Method.java:597)   
  16.         at com.sun.tools.internal.jxc.SchemaGenerator$Runner.main(SchemaGenerator.java:190)   
  17.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   
  18.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)   
  19.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)   
  20.         at java.lang.reflect.Method.invoke(Method.java:597)   
  21.         at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:128)   
  22.         at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:38)   
  23.         at com.sun.tools.internal.jxc.SchemaGenerator.main(SchemaGenerator.java:30)  

After some researching we determined, that the tools.jar needs to be explicitly added to the classpath:

  1. C:\temp>schemagen -cp "%JAVA_HOME%\lib\tools.jar" Example.java   
  2. Note: Writing C:\temp\schema1.xsd   
  3. Note: Writing C:\temp\schema2.xsd  

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多