繁体   English   中英

JAX-WS:找不到类

[英]JAX-WS : class not found

我对Java不熟悉。 这是Web服务,我正在尝试实现-一个基本示例,并且我面临编译错误。 我不确定我在这里想念什么。

在此处输入图片说明

这是代码。

package com.joshis1.jaxws;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@WebService
@SOAPBinding(style = Style.DOCUMENT)
public interface IwebServiceInterface {
@WebMethod String sayHello(String name);
}

接下来,实现接口

package com.joshis1.jaxws;

import javax.jws.WebService;

@WebService(endpointInterface = "com.joshis1.jaxws")
public class webServiceImpl implements IwebServiceInterface {
    @Override
     public  String sayHello(String name)
     {
        return "Hello Shreyas " +  name;
     }
}

接下来,主类发布端点

package com.joshis1.publisher;
import javax.xml.ws.Endpoint;

import com.joshis1.jaxws.*;

public class WebServicePublisher {

    public static void main(String[] args) {
        Endpoint.publish("http://localhost:8888/webservice/helloworld", new webServiceImpl());

    }

}

接下来,一个非常基本的问题-我需要在这里安装Web服务器吗?

您将您的endpointInterface指向您的包:

@WebService(endpointInterface = "com.joshis1.jaxws")

它需要引用您的界面:

@WebService(endpointInterface = "com.joshis1.jaxws.IwebServiceInterface")

查看错误在说什么是非常重要的

class:com.joshis1.jaxws找不到

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM