EJB3.0异常总结---javax.ejb.EJBException: Local and Remote Interfaces cannot have duplicate interface for

javax.ejb.EJBException: Local and Remote Interfaces cannot have duplicate interface for bean UserManagerBean
at org.jboss.ejb3.SessionContainer.checkForDuplicateLocalAndRemoteInterfaces(SessionContainer.java:134)
at org.jboss.ejb3.SessionContainer.instantiated(SessionContainer.java:119)
at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:492)
at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:442)

UserManagerBean中的@Local,@Remote必须明确写上接口的类型,才可以。修改代码如下:

package cn.study.ejb;

import javax.ejb.Local;
import javax.ejb.Remote;
import javax.ejb.Stateless;

@Stateless
@Remote(UserManager.class)
@Local(UserManager.class)
public class UserManagerBean implements UserManager{

public void addUser(User user){
System.out.println(user.getUsername() + "已经被成功保存!");
user.setId(13);


你可能感兴趣的:(interfaces)