如何解决NetBeans中的此wsimport错误?

时间:2010-11-19 05:26:00

标签: java netbeans wsimport

我在Mac OS X 10.6.4和Java 1.6.0_22上使用NetBeans 6.9.1。我有一个通过JAX-WS连接到应用程序服务器(GlassFish v3)的Web应用程序。在“清理和构建”过程中,将调用wsimport以导入存储的WSDL文件。出于某种原因,我只能在启动NetBeans后成功执行一次“清理和构建”。每次后续尝试都会因此错误而失败:

init:
undeploy-clean:
deps-clean:
do-clean:
Deleting directory /Users/justin/Development/flower_vs/build
Deleting directory /Users/justin/Development/flower_vs/dist
check-clean:
clean:
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
wsimport-init:
Created dir: /Users/justin/Development/flower_vs/build/generated-sources/jax-ws
wsimport-client-ChartDataService:
Created dir: /Users/justin/Development/flower_vs/build/generated/jax-wsCache/ChartDataService
command line: wsimport -d /Users/justin/Development/flower_vs/build/generated/jax-wsCache/ChartDataService -extension -Xnocompile -Xendorsed -keep -s /Users/justin/Development/flower_vs/build/generated/jax-wsCache/ChartDataService -catalog /Users/justin/Development/flower_vs/catalog.xml -verbose /Users/justin/Development/flower_vs/src/conf/xml-resources/web-service-references/ChartDataService/wsdl/dev_8080/flower/analysis/ChartDataService.wsdl -p name.justinthomas.flower.analysis.services.ChartData -wsdllocation http://dev:8080/flower/analysis/ChartDataService?wsdl
/Users/justin/Development/flower_vs/nbproject/jaxws-build.xml:31: Error starting wsimport: 
BUILD FAILED (total time: 1 second)

注意到的行是此目标中的“wsimport”指令:

<target name="wsimport-client-ChartDataService" depends="wsimport-init">
  <mkdir dir="${build.generated.dir}/jax-wsCache/ChartDataService"/>
  <wsimport sourcedestdir="${build.generated.dir}/jax-wsCache/ChartDataService" destdir="${build.generated.dir}/jax-wsCache/ChartDataService" wsdl="${basedir}/${conf-dir}xml-resources/web-service-references/ChartDataService/wsdl/dev_8080/flower/analysis/ChartDataService.wsdl" catalog="catalog.xml" extension="true" verbose="true" wsdlLocation="http://dev:8080/flower/analysis/ChartDataService?wsdl" xnocompile="true" xendorsed="true" package="name.justinthomas.flower.analysis.services.ChartData">
    <depends file="${basedir}/${conf-dir}xml-resources/web-service-references/ChartDataService/wsdl/dev_8080/flower/analysis/ChartDataService.wsdl"/>
    <produces dir="${build.generated.dir}/jax-wsCache/ChartDataService"/>
  </wsimport>
  <copy todir="${build.generated.sources.dir}/jax-ws">
    <fileset dir="${build.generated.dir}/jax-wsCache/ChartDataService">
       <include name="**/*.java"/>
    </fileset>
  </copy>
</target>

我可以成功地从命令行手动运行wsimport行(复制和粘贴)。当我这样做时,NetBeans会在下一个Web服务目标上出现错误。

要更正此错误,我必须关闭NetBeans并重新启动。一旦我这样做,我可以再次执行一次“清理和构建”,然后再次卡住。

我只在Mac上看到此问题 - 我在Windows 7上安装的NetBeans没有此问题,但我找不到可能导致Mac问题的配置差异。

很明显,我为wsimport获取的错误消息非常无益。我似乎无法弄清楚如何获得更详细的错误消息来弄清楚实际发生了什么。你知道我怎么做吗?我猜测正在加载一个导致冲突的库,但我不知道从哪里开始追踪问题所在。

提前谢谢!

1 个答案:

答案 0 :(得分:3)

我遇到了同样的错误。为了解决这个问题,我所做的就是删除

catalog="catalog.xml"

来自wsimport标记属性,到目前为止我没有遇到任何问题,我可以在NetBeans 6.9中随意清理和构建。你的看起来像这样:

<target name="wsimport-client-ChartDataService" depends="wsimport-init">
  <mkdir dir="${build.generated.dir}/jax-wsCache/ChartDataService"/>
  <wsimport sourcedestdir="${build.generated.dir}/jax-wsCache/ChartDataService"   destdir="${build.generated.dir}/jax-wsCache/ChartDataService" wsdl="${basedir}/${conf-dir}xml-resources/web-service-references/ChartDataService/wsdl/dev_8080/flower/analysis/ChartDataService.wsdl" extension="true" verbose="true" wsdlLocation="http://dev:8080/flower/analysis/ChartDataService?wsdl" xnocompile="true" xendorsed="true" package="name.justinthomas.flower.analysis.services.ChartData">
    <depends file="${basedir}/${conf-dir}xml-resources/web-service-references/ChartDataService/wsdl/dev_8080/flower/analysis/ChartDataService.wsdl"/>
    <produces dir="${build.generated.dir}/jax-wsCache/ChartDataService"/>
  </wsimport>
  <copy todir="${build.generated.sources.dir}/jax-ws">
  <fileset dir="${build.generated.dir}/jax-wsCache/ChartDataService">
     <include name="**/*.java"/>
   </fileset>
  </copy>
</target>