Question

Java class:

    @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 + "]";
    }
 }
  • JDK version : 1.6.0_31
  • Exception Stack Trace 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)
    

    Can anyone please help me out here?

No correct solution

OTHER TIPS

Try adding the classpath. schemagen -cp "%java_home%\lib\tools.jar" User.java

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top