找不到taskdef类com.sun.tools.ws.ant.WsImport后面的“java web services tutorial” [英] taskdef class com.sun.tools.ws.ant.WsImport cannot be found Following "The java web services tutorial"

查看:583
本文介绍了找不到taskdef类com.sun.tools.ws.ant.WsImport后面的“java web services tutorial”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在许多不同的地方看到同样的问题,即使经过大量的谷歌搜索,我也无法解决它。我想做的事情(更大的图片)是通过 java网络服务教程,似乎在点不同步,

I saw the same issue in many different locations and even after a good portion of googling, I could not resolve it. What I am trying to do (the bigger picture) is to go through The java web services tutorial, which seems at points out of sync,

特别是这里,当我尝试编译时,收到以下消息:

Specially here, when I try to compile, I get the following message:


C:\ _javaeetutorial5 \ examples = \\ jaxws \ common \ _targets.xml:26:taskdef class com.sun。找不到tools.ws.ant.WsImport

我尝试了许多不同的放置罐子或更改环境变量的组合,但没有结果。任何成功的故事?

I have tried many different combinations of placing jars or changing environment variables, but with no result. Any successful stories?

完整构建错误消息如下:

The full build error message is the following:


BUILD FAILED

BUILD FAILED

C:\ javaeetutorial5 \ examples = \\ jaxws \ shellsoservice \ build.xml:4:执行此行时出现以下错误:

C:\javaeetutorial5\examples\jaxws\helloservice\build.xml:4: The following error occurred while executing this line:

C:\ _javaeetutorial5 \ examples = \\ jaxws \ common \\\ _targets.xml:26:taskdef类com.sun.tools.ws.ant所需的类找不到.WsImport:org / apache / tools / ant / DynamicConfigurator

C:\javaeetutorial5\examples\jaxws\common\targets.xml:26: taskdef A class needed by class com.sun.tools.ws.ant.WsImport cannot be found: org/apache/tools/ant/DynamicConfigurator

使用类加载器AntClassLoader [C:\Program Files(x86)\ Java \ _ddk1 .6.0_23\lib\tools.jar]

using the classloader AntClassLoader[C:\Program Files (x86)\Java\jdk1.6.0_23\lib\tools.jar]

总时间:0秒

以及相应的 taskdef

<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
    <classpath refid="jaxws.classpath"/>
</taskdef>

还可以查看认可目录:

C:\javaeetutorial5\kschneid>cd %JAVA_HOME%

C:\Program Files (x86)\Java\jdk1.6.0_23>dir lib\endorsed
 Volume in drive C is OSDisk
 Volume Serial Number is AAAA-BBBB

 Directory of C:\Program Files (x86)\Java\jdk1.6.0_23\lib\endorsed

25/02/2011  09:34    <DIR>          .
25/02/2011  09:34    <DIR>          ..
25/02/2011  09:34           105,134 jaxb-api.jar
25/02/2011  09:33            54,476 jaxws-api.jar
               2 File(s)        159,610 bytes
               2 Dir(s)  110,907,056,128 bytes free

C:\Program Files (x86)\Java\jdk1.6.0_23>


推荐答案

好吧,显然是一个带有<的网站的链接这个问题的解决方案是不可接受的,所以我会在这里粘贴答案:

Well, apparently a link to a website with the solution to this issue is unacceptable, so I'll paste the answer here:

<property name="BUILD_LIBS" location="C:/Projects/Build/Libs/" />

<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
    <classpath>
        <pathelement location="${BUILD_LIBS}/jaxws-ri/lib/jaxws-tools.jar"/>
    </classpath>
</taskdef>

问题是由于相关的 jaxws jar不在类路径中看到上面的pathelement节点。将jar添加到类路径可以解决问题。

The issue is due to the relevant jaxws jar not being in the class path see the pathelement node above. Adding the jar to the classpath resolves the issue.

这篇关于找不到taskdef类com.sun.tools.ws.ant.WsImport后面的“java web services tutorial”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆