NetBeansで単純なJavaEEプロジェクトを作成しました(「ファイル」->「新規プロジェクト」->「JavaWeb」->「Webアプリケーション」)。
新しく作成したプロジェクトで、「CesaService」というWebサービスを追加しました。ソースは次のとおりです。
package com.convista.jcesa.webservice;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService(serviceName = "CesaService")
public class CesaService {
@WebMethod(operationName = "hello")
public String hello(@WebParam(name = "name") String txt) {
return "Hello " + txt + " !";
}
}
次に、NetBeanは次のファイルを生成しました。
sun-jaxws.xml:
<?xml version="1.0" encoding="UTF-8"?>
<endpoints version="2.0" xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime">
<endpoint implementation="com.convista.jcesa.webservice.CesaService" name="CesaService" url-pattern="/CesaService"/>
</endpoints>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>CesaService</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CesaService</servlet-name>
<url-pattern>/CesaService</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
私のサーバーは出荷されたTomcat7.0.22.0です。プロジェクトを開始すると、次のエラーが発生します。
Schwerwiegend: WSSERVLET11: failed to parse runtime descriptor: javax.xml.ws.WebServiceException: class com.convista.jcesa.webservice.jaxws.Hello do not have a property of the name name
javax.xml.ws.WebServiceException: class com.convista.jcesa.webservice.jaxws.Hello do not have a property of the name name
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:531)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.createArgumentsBuilder(EndpointMethodHandler.java:133)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.<init>(EndpointMethodHandler.java:106)
at com.sun.xml.ws.server.sei.SEIInvokerTube.<init>(SEIInvokerTube.java:82)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:219)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:505)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:253)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:124)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: javax.xml.bind.JAXBException: name is not a valid property on class com.convista.jcesa.webservice.jaxws.Hello
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:971)
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:520)
... 16 more
Jun 13, 2012 2:31:35 PM org.apache.catalina.core.StandardContext startInternal
Schwerwiegend: Error listenerStart
Jun 13, 2012 2:31:35 PM org.apache.catalina.core.StandardContext startInternal
Schwerwiegend: Context [/FST] startup failed due to previous errors
Jun 13, 2012 2:31:35 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextDestroyed
Information: WSSERVLET13: JAX-WS context listener destroyed
Jun 13, 2012 2:31:36 PM org.apache.catalina.core.StandardContext reload
Information: Reloading Context with name [/FST] is completed
何がこれを引き起こすのか分かりますか?クラスが欲しくなくて、com.convista.jcesa.webservice.jaxws.Hello
どこで参照されているのかわかりません。
前もって感謝します!