没有EJB接收器可供处理

时间:2016-01-17 18:05:03

标签: hibernate jpa java-ee soap ejb-3.1

我正在研究一个简单的EJB应用程序我完成了ejb应用程序它的工作实体是在数据库中创建但是当我尝试使用客户端ejb使用RMI连接到我的ejb应用程序时我有这个错误,没有EJB接收器可用于处理我使用soap Web服务创建了一个其他动态Web应用程序我在控制台中看到Web服务是使用地址生成的但我无法获取wsdl

客户端RMI代码:

public class ClientRemote {

    public static void main(String[] args) {
        try {
            Context ctx=new InitialContext();
            String appName="BanqueEAR";
            String moduleName="BanqueEJB";
            String beanName="BK";
            String remoteInterface=BanqueRemote.class.getName();
            String name="ejb:"+appName+"/"+moduleName+"/"+beanName+"!"+remoteInterface;

            BanqueRemote proxy=(BanqueRemote) ctx.lookup(name);

            proxy.addCompte(new Compte());
            proxy.addCompte(new Compte());
            proxy.addCompte(new Compte());


            Compte cp=proxy.getCompte(1L);
            System.out.println(cp.getSolde());

            proxy.verser(1L, 4000);
            proxy.retirer(1L, 2000);
            proxy.virement(1L,2L ,1000);
            List<Compte> cptes=proxy.listComptes();
            for(Compte c:cptes){
                System.out.println(c.getCode()+":"+c.getSolde());
            }

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}

我的EJB会话是

@Stateless(name="BK")
public class BanqueEJBImpl implements BanqueLocal,BanqueRemote {
    @PersistenceContext
    private EntityManager em;
    @Override
    public Compte addCompte(Compte cp) {
        em.persist(cp);
        return cp;
    }

    @Override
    public Compte getCompte(Long code) {
        Compte cp=em.find(Compte.class, code);
        if(cp==null) throw new RuntimeException("Compte introuvable");
        return cp;
    }

    @Override
    public List<Compte> listComptes() {
        Query req=em.createQuery("select c from Compte c");
        return req.getResultList();
    }

    @Override
    public void verser(Long code, double mt) {
        Compte cp=getCompte(code);
        cp.setSolde(cp.getSolde()+mt);
    }

    @Override
    public void retirer(Long code, double mt) {
        Compte cp=getCompte(code);
        if(cp.getSolde()<mt) throw new RuntimeException("Solde insuffisant");
        cp.setSolde(cp.getSolde()-mt);      
    }

    @Override
    public void virement(Long cp1, Long cp2, double mt) {
        retirer(cp1, mt);
        verser(cp2, mt);
    }

}

我的远程界面

@Remote
public interface BanqueRemote {
  public Compte addCompte(Compte cp);
  public Compte getCompte(Long code);
  public List<Compte> listComptes();
  public void verser(Long code, double mt);
  public void retirer(Long code, double mt);
  public void virement(Long cp1,Long cp2, double mt);
}

当我在wildfly服务器上运行ejb应用程序时,我发布了这样的消息:

java:global/BanqueEAR/BanqueEJB/BK!metier.BanqueLocal
    java:app/BanqueEJB/BK!metier.BanqueLocal
    java:module/BK!metier.BanqueLocal
    java:global/BanqueEAR/BanqueEJB/BK!metier.BanqueRemote
    java:app/BanqueEJB/BK!metier.BanqueRemote
    java:module/BK!metier.BanqueRemote
    java:jboss/exported/BanqueEAR/BanqueEJB/BK!metier.BanqueRemote

Web服务肥皂的工作

 address=http://localhost:8095/BanqueWeb/BanqueService
 implementor=service.BanqueService
 serviceName={http://service/}BanqueServiceService
 portName={http://service/}BanqueServicePort
 annotationWsdlLocation=null
 wsdlLocationOverride=null
 mtomEnabled=false

但我无法通过链接 http://localhost:8095/BanqueWeb/BanqueService?wsdl 获取我的wsdl 我无法使用客户端RMI连接到我的应用程序我有这个错误:

**INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@10587f1, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@176b067,channel=jboss.ejb,nodename=pc-ayoub]} on channel Channel ID 982c07dd (outbound) of Remoting connection 01951908 to /127.0.0.1:8080
janv. 17, 2016 6:02:21 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
INFO: EJBCLIENT000015: Initial module availability report for Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@176b067,channel=jboss.ejb,nodename=pc-ayoub] wasn't received during the receiver context association
java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:BanqueEAR, moduleName:BanqueEJB, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@80503
    at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:749)**

任何人都可以知道如何解决这个问题吗?

0 个答案:

没有答案