Java类:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "user", propOrder = {
"id",
"name" })
public class User {
@XmlAttribute(required=true)
private long id;
@XmlAttribute(required=true)
private String name;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "User [id=" + id + ", name=" + name + "]";
}
}
异常堆栈跟踪 schemagen User.java
C:\anirban\work_eclipse_juno\RestfulWSDemo\src\com\domain>schemagen User.java
An exception has occurred in apt (1.6.0_31). Please file a bug at the Java Devel
oper Connection (http://java.sun.com/webapps/bugreport) 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(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.tools.internal.jxc.SchemaGenerator$Runner.main(SchemaGenerato
r.java:215)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:1
53)
at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:6
3)
at com.sun.tools.internal.jxc.SchemaGenerator.main(SchemaGenerator.java:
55)
有人可以帮我吗?
答案 0 :(得分:2)
尝试添加类路径。 schemagen -cp“%java_home%\ lib \ tools.jar”User.java