2017-02-16 139 views
0

我使用Web Services - > Generate Java Bean Skeleton从WSDL文件创建WS。然后在web.xml上发布它,并尝试使用Web Services Explorer访问它。javax.servlet.UnavailableException:SRVE0201E:Servlet [my_ws]:不是servlet类

然后我得到了异常: javax.servlet.UnavailableException:SRVE0201E:Servlet的[my_ws]:不是一个servlet类

我有那些生成的文件:

的HelloWorld接口:

package helloWorld; 

import javax.jws.WebMethod; 
import javax.jws.WebParam; 
import javax.jws.WebResult; 
import javax.jws.WebService; 
import javax.xml.bind.annotation.XmlSeeAlso; 
import javax.xml.ws.RequestWrapper; 
import javax.xml.ws.ResponseWrapper; 

@WebService(name = "HelloWorld", targetNamespace = "[something]") 
@XmlSeeAlso({ 
    ObjectFactory.class 
}) 
public interface HelloWorld 
{ 
    @WebMethod(action = "sayHello") 
    @WebResult(name = "sayHelloReturn", targetNamespace = "") 
    @RequestWrapper(localName = "sayHello", targetNamespace = "[something]", className = "helloworld.HelloWorld") 
    @ResponseWrapper(localName = "sayHelloResponse", targetNamespace = "[something]", className = "helloworld.HelloWorldResponse") 
    public String sayHello(
     @WebParam(name = "userIdStr", targetNamespace = "") 
     String userIdStr, 
     @WebParam(name = "text", targetNamespace = "") 
     Integer text); 

} 

和以下Impl:

package helloWorld; 

import helloworld.HelloWorld 


@javax.jws.WebService(endpointInterface = "helloworld.HelloWorld", targetNamespace = "[something]", serviceName = "HelloWorldService", portName = "HelloWorldImpl") 
public class HelloWorldImpl 
{ 

    public String sayHello(String userIdStr, Integer text) 
    { 
     return "Hello " + userIdStr + ", " + text; 
    } 

} 

的web.xml文件:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app 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" 
version="3.0"> 
<display-name>Test</display-name> 

<servlet> 
    <servlet-name>helloworld_HelloWorld</servlet-name> 
    <servlet-class>helloworld.HelloWorldImpl</servlet-class> 
    <load-on-startup>1</load-on-startup> 
</servlet> 

<servlet-mapping> 
    <servlet-name>helloworld_HelloWorld</servlet-name> 
    <url-pattern>services/HelloWorldImpl</url-pattern> 
</servlet-mapping> 
<welcome-file-list> 
    <welcome-file>index.html</welcome-file> 
    <welcome-file>index.htm</welcome-file> 
    <welcome-file>index.jsp</welcome-file> 
    <welcome-file>default.html</welcome-file> 
    <welcome-file>default.htm</welcome-file> 
    <welcome-file>default.jsp</welcome-file> 
</welcome-file-list> 

我改变了真实姓名并实现了一套内容,因为我不能发表。 但这不是问题。

为什么我不能发布这个WS?谢谢。

+0

是否将它作为eclipse对话框引发,请尝试验证您的WSDL的结构 –

回答

0

问题通过删除web.xml解决。

我想删除<servlet><servlet-mapping>标签也可以做到这一点。