Java 修改源代码并重新生成Web服务时,JAX-WS Web服务不会更新

Java 修改源代码并重新生成Web服务时,JAX-WS Web服务不会更新,java,web-services,Java,Web Services,我创建了两个服务publicstringadd(intx,inty)和publicstringsub(intx,inty)。现在,这些服务的定义如下: package com.webservice.calc; import javax.jws.WebService;; @WebService public class Calculator { String s; public String add(int x, int y) { s = "Sum o

我创建了两个服务
publicstringadd(intx,inty)
publicstringsub(intx,inty)
。现在,这些服务的定义如下:

package com.webservice.calc;

import javax.jws.WebService;;

@WebService
public class Calculator {

    String s;
    public String add(int x, int y)
    {
        s = "Sum of "+x+" and "+y+" is : "+(x+y);
        return s;
    }

    public String sub(int x, int y)
    {
        s = "Sum of "+x+" and "+y+" is : "+(x-y);
        return s;
    }
}
我没有写差,而是在
sub
服务中写了Sum

然后,我使用wsgen工具生成wsdl文件,并使用端点发布器发布它

然后,我创建了另一个项目(Web服务使用者),并使用wsimport导入了Web服务

代码运行正常。但是,现在我想把和改成差

我更改了原始代码中的代码,然后使用wsgen,然后重新发布(这里有一个错误:

Exception in thread "main" Server Runtime Error: Server Runtime Error: java.net.BindException: Address already in use: bind
    at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(Unknown Source)
    at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(Unknown Source)
    at javax.xml.ws.Endpoint.publish(Unknown Source)
    at com.webservice.calc.endpoint.CalcEndpointPublisher.main(CalcEndpointPublisher.java:12)
Caused by: Server Runtime Error: java.net.BindException: Address already in use: bind
    at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(Unknown Source)
    ... 5 more
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind(Native Method)
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
    at sun.net.httpserver.ServerImpl.<init>(Unknown Source)
    at sun.net.httpserver.HttpServerImpl.<init>(Unknown Source)
    at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(Unknown Source)
    at com.sun.net.httpserver.HttpServer.create(Unknown Source)
    ... 6 more
线程“main”中的异常服务器运行时错误:服务器运行时错误:java.net.BindException:地址已在使用中:bind
位于com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(未知源)
位于com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(未知源)
位于com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishindPoint(未知源)
位于javax.xml.ws.Endpoint.publish(未知源)
位于com.webservice.calc.endpoint.CalcEndpointPublisher.main(CalcEndpointPublisher.java:12)
原因:服务器运行时错误:java.net.BindException:地址已在使用中:bind
位于com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(未知源)
…还有5个
原因:java.net.BindException:地址已在使用中:bind
位于sun.nio.ch.Net.bind(本机方法)
位于sun.nio.ch.serversocketchannelpl.bind(未知源)
位于sun.nio.ch.ServerSocketAdaptor.bind(未知源)
位于sun.net.httpserver.ServerImpl。(未知源)
位于sun.net.httpserver.HttpServerImpl。(未知源)
位于sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(未知源)
位于com.sun.net.httpserver.httpserver.create(未知源)
…还有6个

)
然后再次导入。但没有变化。这里的问题是什么

看起来您想在另一个服务已使用的地址上启动服务。也许你没杀老家伙?怎么杀老家伙?我对它完全陌生。所以Unaware我认为你们可以终止这个进程。如果您从cmd运行它,请使用
ctrl+c
If from eclipse,只需转到终端并点击红方块按钮即可。@mlethys谢谢。有红色按钮。