鑑於這種ant腳本:的NullPointerException在com.sun.tools.jxc.SchemaGenTask
<?xml version="1.0" encoding="UTF-8"?>
<project name="projectname" default="generate-schema" basedir=".">
<taskdef name="schemagen" classname="com.sun.tools.jxc.SchemaGenTask">
<classpath>
<fileset dir="../BuildJars/lib" includes="*.jar" />
</classpath>
</taskdef>
<target name="generate-schema">
<schemagen srcdir="src/gb/informaticasystems/messages" destdir="schema">
<schema namespace="http://www.informatica-systems.co.uk/aquarius/messages/1.0" file="messages-1.0.xsd" />
</schemagen>
</target>
</project>
我收到此錯誤:
Buildfile: C:\Users\davidcollie\workspace\aquarius-feature\AquariusServerLibrary\schemagen.xml
generate-schema:
[schemagen] Generating schema from 4 source files
[schemagen] Problem encountered during annotation processing;
[schemagen] see stacktrace below for more information.
[schemagen] java.lang.NullPointerException
[schemagen] at com.sun.tools.jxc.model.nav.APTNavigator$2.onDeclaredType(APTNavigator.java:428)
[schemagen] at com.sun.tools.jxc.model.nav.APTNavigator$2.onClassType(APTNavigator.java:402)
[schemagen] at com.sun.tools.jxc.model.nav.APTNavigator$2.onClassType(APTNavigator.java:456)
[schemagen] at com.sun.istack.tools.APTTypeVisitor.apply(APTTypeVisitor.java:27)
[schemagen] at com.sun.tools.jxc.model.nav.APTNavigator.getBaseClass(APTNavigator.java:109)
[schemagen] at com.sun.tools.jxc.model.nav.APTNavigator.getBaseClass(APTNavigator.java:85)
[schemagen] at com.sun.xml.bind.v2.model.impl.PropertyInfoImpl.getIndividualType(PropertyInfoImpl.java:190)
[schemagen] at com.sun.xml.bind.v2.model.impl.PropertyInfoImpl.<init>(PropertyInfoImpl.java:132)
[schemagen] at com.sun.xml.bind.v2.model.impl.MapPropertyInfoImpl.<init>(MapPropertyInfoImpl.java:67)
[schemagen] at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.createMapProperty(ClassInfoImpl.java:917)
[schemagen] at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.addProperty(ClassInfoImpl.java:874)
[schemagen] at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.findGetterSetterProperties(ClassInfoImpl.java:993)
[schemagen] at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:303)
[schemagen] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:243)
[schemagen] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:209)
[schemagen] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:315)
[schemagen] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:330)
[schemagen] at com.sun.tools.xjc.api.impl.j2s.JavaCompilerImpl.bind(JavaCompilerImpl.java:90)
[schemagen] at com.sun.tools.jxc.apt.SchemaGenerator$1.process(SchemaGenerator.java:115)
[schemagen] at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
[schemagen] at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
[schemagen] at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:258)
[schemagen] at com.sun.tools.apt.main.Main.compile(Main.java:1102)
[schemagen] at com.sun.tools.apt.main.Main.compile(Main.java:964)
[schemagen] at com.sun.tools.apt.Main.processing(Main.java:95)
[schemagen] at com.sun.tools.apt.Main.process(Main.java:85)
[schemagen] at com.sun.tools.apt.Main.process(Main.java:67)
[schemagen] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[schemagen] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[schemagen] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[schemagen] at java.lang.reflect.Method.invoke(Method.java:597)
[schemagen] at com.sun.tools.jxc.AptBasedTask$InternalAptAdapter.execute(AptBasedTask.java:97)
[schemagen] at com.sun.tools.jxc.AptBasedTask.compile(AptBasedTask.java:144)
[schemagen] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:820)
[schemagen] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[schemagen] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[schemagen] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[schemagen] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[schemagen] at java.lang.reflect.Method.invoke(Method.java:597)
[schemagen] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[schemagen] at org.apache.tools.ant.Task.perform(Task.java:348)
[schemagen] at org.apache.tools.ant.Target.execute(Target.java:357)
[schemagen] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[schemagen] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[schemagen] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[schemagen] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[schemagen] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[schemagen] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[schemagen] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[schemagen] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
BUILD FAILED
C:\Users\davidcollie\workspace\aquarius-feature\AquariusServerLibrary\schemagen.xml:11: schema generation failed
Total time: 1 second
任何想法?
不是這樣,但它確實讓我看到了指向我JDK版本的Java Bug Parade。我從運行ant腳本1.6開始切換到1.5,然後導致*正確的堆棧跟蹤被拋出,並從那裏解決了問題。謝謝。 – 2010-04-08 13:46:43
太棒了!也許你可以自己提交答案,以防其他人遇到類似問題的Stack Overflow。 – 2010-04-08 15:23:34