我在查找服务器上托管的EJB时遇到问题。服务器本身是一个SAP环境,基本上是一个修改过的tomcat。
我尝试了几个以
开头的查找字符串java:comp/env/
和
ejb:/
但没有任何作用。
这是服务器对lookupstrings的说法:
ejb:/appName=mycompany.de/reboard~report~cs, jarName=mycompany.de~reboard~report~cs.jar, beanName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb, interfaceName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedLocal
和远程部分:
ejb:/appName=mycompany.de/reboard~report~cs, jarName=mycompany.de~reboard~report~cs.jar, beanName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb, interfaceName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedRemote
我尝试了不同的查找字符串组合,但都失败了。我可以使用以下代码将Proxy对象获取到Bean:
InitialContext().lookup("ejb:/com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedLocal");
但我需要的是直接bean访问。
以下是Bean的定义方式:
@com.sap.engine.services.webservices.espbase.configuration.ann.rt.TransportBindingRT(AltPath="reboard/report/cs~ibsolution.de_com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb")
@UsedReferences(srIds="05bc3ba3-fd85-4381-b6f8-f8a4734b2815, 05bc3ba3-fd85-4381-b6f8-f8a4734b2815, 05bc3ba3-fd85-4381-b6f8-f8a4734b2815", wsdlLocations="ibsolution.de~reboard~report~cs.jar#META-INF/wsdl/consumed/src/wsdl/rootwsdl_BPMFacadeBeanImplService_BPMFacadeBeanImpl.wsdl, ibsolution.de~reboard~report~cs.jar#META-INF/wsdl/consumed/src/wsdl/rootwsdl_BPMFacadeBeanImplService_BPMFacadeBeanImpl.wsdl, ibsolution.de~reboard~report~cs.jar#META-INF/wsdl/consumed/src/wsdl/rootwsdl_BPMFacadeBeanImplService_BPMFacadeBeanImpl.wsdl")
@Stateless(name="com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb")
@EJB(name="BPMBean", beanInterface=BPMFacadeBeanSimplifiedLocal.class)
@WebService(
portName="BPMFacadeBean_simplifiedBindingPort",
endpointInterface="com.sap.bpem.facade.api._simplified.BPMFacadeBeanSimplified",
serviceName="BPMFacadeBean_simplifiedBindingService",
targetNamespace="http://api.facade.bpem.sap.com/_simplified",
wsdlLocation="META-INF/wsdl/composed/src/wsdl/rootwsdl_importedwsdl_1_BPMFacadeBeanImplService_BPMFacadeBeanImpl_simplified.wsdl")
public class BPMFacadeBeanSimplifiedEjb implements
BPMFacadeBeanSimplifiedLocal,
BPMFacadeBeanSimplifiedRemote
本地界面:
@Local
public interface BPMFacadeBeanSimplifiedLocal
extends com.sap.bpem.facade.api._simplified.BPMFacadeBeanSimplified {}
远程接口:
@Remote
public interface BPMFacadeBeanSimplifiedRemote
extends com.sap.bpem.facade.api._simplified.BPMFacadeBeanSimplified {}
BPMFacadeBeanSimplified Interface:
@javax.jws.WebService(name = "BPMFacadeBean_simplified", targetNamespace = "http://api.facade.bpem.sap.com/_simplified")
@javax.jws.soap.SOAPBinding(parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED, style = javax.jws.soap.SOAPBinding.Style.DOCUMENT, use = javax.jws.soap.SOAPBinding.Use.LITERAL)
public interface BPMFacadeBeanSimplified {
@javax.jws.WebMethod(operationName = "getActiveProcesses", action = "http://api.facade.bpem.sap.com/_simplified/getActiveProcesses")
@javax.xml.ws.RequestWrapper(localName = "getActiveProcesses", targetNamespace = "http://api.facade.bpem.sap.com/", className = "com.sap.bpem.facade.api.GetActiveProcesses")
@javax.xml.ws.ResponseWrapper(localName = "getActiveProcessesResponse", targetNamespace = "http://api.facade.bpem.sap.com/", className = "com.sap.bpem.facade.api.GetActiveProcessesResponse")
@javax.jws.WebResult(name = "return", targetNamespace = "")
public java.util.List<com.sap.bpem.facade.api.ProcessInfo> getActiveProcesses(@javax.jws.WebParam(name = "locale", targetNamespace = "") java.lang.String locale);
/**
* Java representation of web method [getProcessDescription].
*/
@javax.jws.WebMethod(operationName = "getProcessDescription", action = "http://api.facade.bpem.sap.com/_simplified/getProcessDescription")
@javax.xml.ws.RequestWrapper(localName = "getProcessDescription", targetNamespace = "http://api.facade.bpem.sap.com/", className = "com.sap.bpem.facade.api.GetProcessDescription")
@javax.xml.ws.ResponseWrapper(localName = "getProcessDescriptionResponse", targetNamespace = "http://api.facade.bpem.sap.com/", className = "com.sap.bpem.facade.api.GetProcessDescriptionResponse")
@javax.jws.WebResult(name = "return", targetNamespace = "")
public java.lang.String getProcessDescription(@javax.jws.WebParam(name = "activeVersionId", targetNamespace = "") java.lang.String activeVersionId, @javax.jws.WebParam(name = "locale", targetNamespace = "") java.lang.String locale);
}
在这种情况下,正确的查找字符串是什么?
感谢您的帮助!
答案 0 :(得分:0)
没有可移植的方式来访问bean实例,所有对ejb的访问都应该通过代理,因为这是容器可以提供它应该为你提供的所有服务的唯一方式(拦截器,依赖注入,安全性,事务......),这就是EJB规范的设计方式,来自EJB 3.0规范(第4.7.3节):
容器的会话业务接口的实现,它由部署生成 工具,实现特定于会话bean的业务方法。 每个业务方法的实现必须激活实例(如果实例处于被动状态 state),调用任何业务方法拦截器方法,并调用匹配的业务方法 实例。 容器提供程序负责提供equals和hashCode的实现 业务接口的方法,符合第3.6.5节的要求
此外,我无法想象你为什么需要直接访问bean实例