0

我有几个 .jar,比如 EasyEjbNode1.jar 和 EasyEjbNode2.jar。EasyEjbNode1.jar 想要从 EasyEjbNode2.jar 调用一个会话 bean,该 bean 之前已成功部署。这是会话 bean 的代码,在 EasyEjbNode1 中,想要从 EasyEjbNode2 调用会话 bean:`

import java.util.Properties;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import edu.pezzati.node2.RemoteNode2;

@Stateless
public class SessionNode1 implements RemoteNode1 {
@EJB(name="java:global/SessionNode2!edu.pezzati.node2.RemoteNode2")

RemoteNode2 rn2;

    @Override
    public String getNodeName() {
        return "node1 ";
    }

    @Override
    public String getRemoteNodeName() {
        return "node1 "+rn2.getNodeName();
    }
}

` 这里是 EasyEjbNode1.jar/META-INF/MANIFEST.MF 的内容:

Manifest-Version: 1.0
Dependencies: deployment.EasyEjbNode2.jar

可悲的是,出了点问题:

10:40:04,725 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."EasyEjbNode1.jar".INSTALL: org.jbos.msc.service.StartException in service jboss.deployment.unit."EasyEjbNode1.jar".INSTALL: Failed to process phase INSTALL of deployment "EasyEjbNode1.jar"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: 
    JBAS014544: No EJB found with interface of type 'edu.pezzati.node2.RemoteNode2' for binding java:global/EasyEjbNode2/SessionNode2!edu.pezzati.node2.RemoteNode2
    at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:88)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:249)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:194)
    at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:162)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:155)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    ... 5 more

TIA。

4

1 回答 1

2

我自己管理。这个问题只是一个愚蠢的错误。代替

    @EJB(name="java:global/SessionNode2!edu.pezzati.node2.RemoteNode2")

    @EJB(lookup="java:global/SessionNode2!edu.pezzati.node2.RemoteNode2")

这对我有用。我可以从放置在不同 jar 中的 SessionNode1 成功调用 SessionNode2 的服务。

于 2013-04-15T15:32:16.027 回答