代码如下。
eclipse 4.5.1,不知道还需要设置什么import javax.ejb.Stateless; 和@Stateless才不错误.
package javaeetutorial.helloservice.ejb;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;
/**
* Session Bean implementation class HelloServiceBean
*/
@Stateless
@WebService
public class HelloServiceBean {
private final String message = “Hello, “;
public void HelloServiceBean() {
}
@WebMethod
public String sayHello(String name) {
return message + name + “.”;
}
}
eclipse 4.5.1,不知道还需要设置什么import javax.ejb.Stateless; 和@Stateless才不错误.
package javaeetutorial.helloservice.ejb;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;
/**
* Session Bean implementation class HelloServiceBean
*/
@Stateless
@WebService
public class HelloServiceBean {
private final String message = “Hello, “;
public void HelloServiceBean() {
}
@WebMethod
public String sayHello(String name) {
return message + name + “.”;
}
}
解决方案
20
增加jee server,项目中增加 jee server的运行环境库
下载并安装开源jee服务器,oracle的glassfish,jboss的wildfly,ibm的websphere开发版
eclipse: servers中增加你安装的server,
项目:属性->java build path->liberaries ->add liberary-> server runtime,增加刚刚安装的服务器环境
下载并安装开源jee服务器,oracle的glassfish,jboss的wildfly,ibm的websphere开发版
eclipse: servers中增加你安装的server,
项目:属性->java build path->liberaries ->add liberary-> server runtime,增加刚刚安装的服务器环境