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:
- C:\temp>schemagen Example.java
- An exception has occurred in apt (1.6.0_07). Please file a bug at the
- Java Developer Connection (http:
- after checking the Bug Parade for duplicates. Include your program and
- the following diagnostic in your report. Thank you.
- java.lang.NullPointerException
- at com.sun.tools.apt.main.CommandLine.parse(CommandLine.java:42)
- at com.sun.tools.apt.main.Main.compile(Main.java:775)
- at com.sun.tools.apt.Main.processing(Main.java:95)
- at com.sun.tools.apt.Main.process(Main.java:85)
- at com.sun.tools.apt.Main.process(Main.java:67)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at com.sun.tools.internal.jxc.SchemaGenerator$Runner.main(SchemaGenerator.java:190)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:128)
- at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:38)
- at com.sun.tools.internal.jxc.SchemaGenerator.main(SchemaGenerator.java:30)
C:\temp>schemagen Example.javaAn exception has occurred in apt (1.6.0_07). Please file a bug at theJava Developer Connection (http://java.sun.com/webapps/bugreport)after checking the Bug Parade for duplicates. Include your program andthe following diagnostic in your report. Thank you.java.lang.NullPointerExceptionat com.sun.tools.apt.main.CommandLine.parse(CommandLine.java:42)at com.sun.tools.apt.main.Main.compile(Main.java:775)at com.sun.tools.apt.Main.processing(Main.java:95)at com.sun.tools.apt.Main.process(Main.java:85)at com.sun.tools.apt.Main.process(Main.java:67)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at com.sun.tools.internal.jxc.SchemaGenerator$Runner.main(SchemaGenerator.java:190)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:128)at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:38)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:
- C:\temp>schemagen -cp "%JAVA_HOME%\lib\tools.jar" Example.java
- Note: Writing C:\temp\schema1.xsd
- Note: Writing C:\temp\schema2.xsd
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。