java调用 Myeclipse用jax-ws创建的webservice具体方法(二)

点击java调用 Myeclipse用jax-ws创建的webservice具体方法(二)start启动tomcat服务器

1 启动服务器后,报如下错误:java调用 Myeclipse用jax-ws创建的webservice具体方法(二)
解决方法:在项目的构建路径中加入jax-ws的相关jar包

java调用 Myeclipse用jax-ws创建的webservice具体方法(二)

java调用 Myeclipse用jax-ws创建的webservice具体方法(二) 
2 出现如下错误信息,表示.apt_generated源码包下没有自动生成jax-ws相应的类,所以提示是否已经用apt生成了。
信息: WSSERVLET12: JAX-WS context listener initializing
2012-3-1 21:58:41 com.sun.xml.ws.transport.http.servlet.WSServletContextListenercontextInitialized
严重: WSSERVLET11: failed to parse runtime descriptor: runtime modeler error: Wrapper class com.test.webservice.jaxws.Add is not found. Have you run APT to generate them?
com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.test.webservice.jaxws.Add is not found. Have you run APT to generate them?
如果生成了,部署到tomcat的项目文件中会在服务类下生成一个jaxws包:

java调用 Myeclipse用jax-ws创建的webservice具体方法(二)
对本例而言,jaxws中有如下文件:

java调用 Myeclipse用jax-ws创建的webservice具体方法(二)
解决办法:确保构建路径中的source选项卡中选择了.apt_generated,如果还没生成,clean下项目应该就没问题了

3 误删除了自动生成的.apt_generated源码包

When the Feature Pack for Web Services 1.0 facet is enabled, the .apt_generated folder is created in the Web project. If this folder is accidentally deleted, it is automatically restored, but it no longer has the properties of a source folder. Thus, the classes in this folder are not built into the class path for the Web project and ClassNotFound exceptions might occur after the Web project is deployed to the server.

Resolving the problemAfter the folder is deleted, it is not present in the Java? 2 Platform, Enterprise Edition (J2EE) perspective. Follow these steps to restore the source folder:

解决办法:

1.Open the Resource perspective. You should see the .apt_generated folder, which is automatically regenerated.
2.Open the .settings/org.eclipse.wst.common.component file.
3.From the Source view, delete the following line:
<wb-resource deploy-path="/WEB-INF/classes" source-path="/.apt_generated"/>
4.Right-click the project and select Properties > Java Build Path
5.On the Source tab, add .apt_generated to the list of Source folders.



发布成功后,在浏览器输入:

http://localhost:8100/wsDemo/CounterPort

java调用 Myeclipse用jax-ws创建的webservice具体方法(二)

不要忘记Port

会出现如下界面:

java调用 Myeclipse用jax-ws创建的webservice具体方法(二)

至此服务器端编写完毕。下面请看客户端调用此webservice。

java调用 Myeclipse用jax-ws创建的webservice具体方法(二),布布扣,bubuko.com

java调用 Myeclipse用jax-ws创建的webservice具体方法(二)

上一篇:java调用 Myeclipse用jax-ws创建的webservice具体方法(一)


下一篇:WebKit的HTML解析顺序和优化