1

I have a problem to look up a EJB hosted on a server. The server itself is an SAP environment, which is basicly a modified tomcat.

I tried several lookupstrings starting with

java:comp/env/ 

and

ejb:/ 

but nothing works.

This is what the server says about the 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

and for the remote part:

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

I tried diferent combinations of this lookup strings but all fail. I can get the Proxy object to the Bean tho by using this:

InitialContext().lookup("ejb:/com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedLocal");

But what i need as the direct bean access.

Here is how the Bean is defined:

@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 Interface:

@Local
public interface BPMFacadeBeanSimplifiedLocal
    extends com.sap.bpem.facade.api._simplified.BPMFacadeBeanSimplified {}

Remote Interface:

@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);

}

What is the correct lookup string in this case?

Thank you for your help!

DI MI
  • 245
  • 2
  • 5
  • 16
  • 1
    Can you explain why you try to lookup the local interface when you are apparently trying to do a remote lookup? You also fail to mention what your environment is. Which server/container, which version... That may greatly determine what the proper lookup name is, although the documentation of your container should be your first step for proper information. – Gimby Jan 29 '14 at 10:33
  • added server to the problem description. basicly it is a tomcat. – DI MI Jan 29 '14 at 10:46
  • 1
    My comment on the local interface is unchanged. – Gimby Jan 29 '14 at 11:44

1 Answers1

0

There's no portable way to have access to the bean instance, all access to the ejb should go through the proxy, simply because that's the only way the container can provide all the services it's supposed to provide you (interceptors, dependency injection, security, transactions...), that's the way the EJB specification is designed, from the EJB 3.0 spec (Sec. 4.7.3):

The container’s implementation of the session business interface, which is generated by the deployment tools, implements the business methods specific to the session bean. The implementation of each business method must activate the instance (if the instance is in the passive state), invoke any business method interceptor methods, and invoke the matching business method on the instance. The container provider is responsible for providing the implementation of the equals and hashCode methods for the business interface, in conformance with the requirements of section 3.6.5

besides, I can't imagine a reason why would you need to have direct access to the bean instance

Camilo
  • 1,889
  • 2
  • 17
  • 16