Question

i am learning JAXb 2.0 and is new to it.

i am trying to generate XSD based on y POJO classes using schemagen and for simple classes it working fine but when my class contains refrence to other classes

schemagen is giving me error below is the error trace for the same

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

java.lang.NullPointerException
        at com.sun.tools.jxc.model.nav.APTNavigator$2.onDeclaredType(APTNavigator.java:436)
        at com.sun.tools.jxc.model.nav.APTNavigator$2.onClassType(APTNavigator.java:410)
        at com.sun.tools.jxc.model.nav.APTNavigator$2.onClassType(APTNavigator.java:464)
        at com.sun.istack.tools.APTTypeVisitor.apply(APTTypeVisitor.java:27)
        at com.sun.tools.jxc.model.nav.APTNavigator.getBaseClass(APTNavigator.java:113)
        at com.sun.tools.jxc.model.nav.APTNavigator.getBaseClass(APTNavigator.java:89)
        at com.sun.xml.bind.v2.model.impl.PropertyInfoImpl.getIndividualType(PropertyInfoImpl.java:195)
        at com.sun.xml.bind.v2.model.impl.PropertyInfoImpl.<init>(PropertyInfoImpl.java:137)
        at com.sun.xml.bind.v2.model.impl.MapPropertyInfoImpl.<init>(MapPropertyInfoImpl.java:71)
        at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.createMapProperty(ClassInfoImpl.java:928)
        at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.addProperty(ClassInfoImpl.java:885)
        at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.findGetterSetterProperties(ClassInfoImpl.java:1004)
        at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:314)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:247)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:213)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:319)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:334)
        at com.sun.tools.xjc.api.impl.j2s.JavaCompilerImpl.bind(JavaCompilerImpl.java:94)
        at com.sun.tools.jxc.apt.SchemaGenerator$1.process(SchemaGenerator.java:119)
        at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
        at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
        at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:258)
        at com.sun.tools.apt.main.Main.compile(Main.java:1102)
        at com.sun.tools.apt.main.Main.compile(Main.java:964)
        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(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.sun.tools.jxc.SchemaGenerator$Runner.main(SchemaGenerator.java:245)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.sun.tools.jxc.SchemaGenerator.run(SchemaGenerator.java:177)
        at com.sun.tools.jxc.SchemaGenerator.run(SchemaGenerator.java:81)
        at com.sun.tools.jxc.SchemaGenerator.main(SchemaGenerator.java:73)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.sun.tools.jxc.SchemaGeneratorFacade.main(SchemaGeneratorFacade.java:60)
C:\Users\Desktop\jaxb\jaxb-ri-20101119\bin\src\com\tr\model\destination\Destination.java:9: package com.tr.model.address does not exist
import com.tr.model.address.BasicAddress;[code]

below is the detail of my folder structure

schemagen is located at the following location

C:\Users\Desktop\jaxb\jaxb-ri-20101119\bin

My Java class based on which i am trying to generate xsd is at the following location

C:\Users\Desktop\jaxb\jaxb-ri-20101119\bin\src\com\tr\model\destination

Destination.java

while all other classes being refrenced from Destination as well as the class itself are inside the following structure

C:\Users\Raisonne\Desktop\jaxb\jaxb-ri-20101119\bin\src\com\raisonne\tr\model

i know the problem is with the setting of classpath but i am unable to figure it out ho to set correct classpath for this case

i tried to set system's CLASSPATH variable to the value of

C:\Users\Raisonne\Desktop\jaxb\jaxb-ri-20101119\bin\src\com\raisonne\tr\model as well other 2 mentioned in my post but nothing worked out.

can any one help me in setting classpath for the schemagen.

thanks in advance

Umesh

Was it helpful?

Solution

it seems you have set package declaration of your class to

com.tr.model.address  

where it should be from your dir structure

com.tr.model.destination
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top