我使用Ant来构建我的应用程序。以前,相同的build.xml可以成功构建,但是当前我遇到了空指针异常,并且我不确定其原因。请找到我所使用的环境的详细信息,并告诉我我要去哪里了。
Server : Weblogic 12cR2 12.2.1.3
Java : 1.8
Eclipse : Oxygen
Ant Version : Default provided with Eclipse Oxygen (1.10.1)
代码段:
build.xml
------------
<target name="build" description="Compile and build the application archive">
<delete dir="${work.dir}"/>
<antcall target="make.ear" />
</target>
<ant antfile="${basedir}/build_archive.xml"
target="prepare.webservice.jar" inheritall="true" inheritrefs="true">
<property name="app_name" value="sp_docman_ws"/>
<property name="src.dir"
value="${basedir}/../SPDocumentManagementEjb/src"/>
</ant>
-------------------------
build_target.xml
-------------------------
<target name="prepare.webservice.jar" depends="clean.work.dir">
<taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" classpathref="common.classpath"/>
<!-- For JAR -->
<jwsc srcdir="${src.dir}" destdir="${dist.dir}" keepGenerated="yes" compiler="modern" verbose="false" srcEncoding="UTF-8">
<classpath>
<path refid="app.classpath" />
<fileset dir="${dist.dir}" includes="sp_common.jar,sp_docman_ejb.jar" />
</classpath>
<jws file="com/docman/webservice/SPDocManWebService.java" generateWsdl="true" name="${app_name}" type="JAXWS" />
</jwsc>
</target>
我在以下一行中遇到错误:
<jwsc srcdir="${src.dir}" destdir="${dist.dir}" keepGenerated="yes" compiler="modern" verbose="false" srcEncoding="UTF-8">
错误:
build_target.xml:80: java.lang.NullPointerException
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:575)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:444)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:460)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:142)
提供完整的堆栈跟踪:
Complete Stack Trace :
prepare.webservice.jar:
[jwsc] warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[jwsc] Verbose is on.
[jwsc] JWS: processing module sp_docman_ws
[jwsc] Parsing source files
[jwsc] Parsing source files
[AntUtil.deleteDir] Deleting directory C:\Users\Som\AppData\Local\Temp\_tfcc6v
[AntUtil.deleteDir] Deleting directory C:\Users\Som\AppData\Local\Temp\_tfcc6v
[ant] Exiting C:\Somnath\codebase\SPBuild\build_target.xml.
[antcall] Exiting C:\Somnath\codebase\SPBuild\build.xml.
BUILD FAILED
C:\Somnath\codebase\SPBuild\build.xml:395: The following error occurred while executing this line:
C:\Somnath\codebase\SPBuild\build.xml:328: The following error occurred while executing this line:
C:\Somnath\codebase\SPBuild\build_target.xml:80: java.lang.NullPointerException
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:575)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:444)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:460)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:142)
Caused by: C:\Somnath\codebase\SPBuild\build.xml:328: The following error occurred while executing this line:
C:\Somnath\codebase\SPBuild\build_target.xml:80: java.lang.NullPointerException
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:575)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:444)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.eclipse.ant.internal.launching.remote.EclipseSingleCheckExecutor.executeTargets(EclipseSingleCheckExecutor.java:34)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
... 16 more
Caused by: C:\Somnath\codebase\SPBuild\build_target.xml:80: java.lang.NullPointerException
at weblogic.wsee.tools.anttasks.JwscTask.execute(JwscTask.java:249)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.eclipse.ant.internal.launching.remote.EclipseSingleCheckExecutor.executeTargets(EclipseSingleCheckExecutor.java:34)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
... 29 more
Caused by: java.lang.NullPointerException
at com.bea.util.jam.internal.javadoc.JavadocClassBuilder.getImports(JavadocClassBuilder.java:179)
at com.bea.util.jam.internal.javadoc.JavadocClassBuilder.build(JavadocClassBuilder.java:140)
at com.bea.util.jam.provider.CompositeJamClassBuilder.build(CompositeJamClassBuilder.java:51)
at com.bea.util.jam.internal.JamClassLoaderImpl.loadClass(JamClassLoaderImpl.java:128)
at com.bea.util.jam.internal.JamServiceImpl.getAllClasses(JamServiceImpl.java:65)
at weblogic.wsee.util.JamUtil.parseSource(JamUtil.java:168)
at weblogic.wsee.util.JamUtil.parseSource(JamUtil.java:136)
at weblogic.wsee.tools.anttasks.JwsLoader.loadJClasses(JwsLoader.java:187)
at weblogic.wsee.tools.anttasks.JwsLoader.load(JwsLoader.java:75)
at weblogic.wsee.tools.anttasks.JwsModule.loadWebServices(JwsModule.java:631)
at weblogic.wsee.tools.anttasks.JwsModule.generate(JwsModule.java:432)
at weblogic.wsee.tools.anttasks.JwsModule.build(JwsModule.java:306)
at weblogic.wsee.tools.anttasks.JwscTask.execute(JwscTask.java:242)
... 42 more
Total time: 3 minutes 50 seconds
请帮帮我!!!谢谢!