Priyank Doshi
Priyank Doshi

Reputation: 13161

schemagen for nested objects without ant task

I have the following class structure:

@XmlRootElement
public class A{
private String s;
private B b;
//getter and setter
}
@XmlRootElement
public class B{
private String ss;
//getter and setter
}

How to use schemagen to generate schema for class A ?

I am able to generate schema for class B as:

schemagen B.java

at cmd , but when I use same for class A , i.e.:

schemagen A.java

I got following error:

Problem encountered during annotation processing;
see stacktrace below for more information.
java.lang.NullPointerException
.
.
.

A.java:14: cannot find symbol
symbol  : class B
location: class beans.A
    public B getB() {
           ^
A.java:18: cannot find symbol
symbol  : class B
location: class beans.A
    public void setB(B b) {
                     ^
A.java:22: cannot find symbol
symbol  : class B
location: class beans.A
    private B b;
            ^
3 errors

Upvotes: 1

Views: 714

Answers (1)

Priyank Doshi
Priyank Doshi

Reputation: 13161

I found the sollution : We need to specify classpath and all the internal beans also.

Following command worked:

schemagen -cp . A.java B.java

Upvotes: 2

Related Questions