我有几个.jar,说EasyEjbNode1.jar和EasyEjbNode2.jar。 EasyEjbNode1.jar想要从EasyEjbNode2.jar调用会话bean,以前已经成功部署了该会话bean。以下是EasyEjbNode1中想要从EasyEjbNode2调用会话bean的会话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。
答案 0 :(得分:2)
我自己管理。问题只是一个愚蠢的错误。取代
@EJB(name="java:global/SessionNode2!edu.pezzati.node2.RemoteNode2")
与
@EJB(lookup="java:global/SessionNode2!edu.pezzati.node2.RemoteNode2")
这对我有用。我可以成功地从SessionNode1调用SessionNode2的服务,SessionNode1放在不同的jar中。