on 06-30-2008 12:38 PM
Hello,
I am trying to implement a scenario in which an ABAP 7.00 calls an EJB 3.0 stateless session bean on a CE 7.1 via the JCo RFC Provider. I've posted this question already in the CE forum, but didn't get any responses - hope you folks can help me.
The error I get is:
java.lang.RuntimeException: Bean YBPC04_SECOND not found on host trostec, ProgId =JCOTEST01: Exception during lookup operation of object with name rfcaccessejb/YBPC04_SECOND, cannot resolve object reference.
at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:121)
at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:269)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:152)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:247)
Caused by: com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name rfcaccessejb/YBPC04_SECOND, cannot resolve object reference. [Root exception is javax.ejb.EJBException: Bean aoksystems.de/jco~ear*xml|aoksystems.de~jco~ejb.jar*xml|YBPC04_SECOND does not expose RFC access]
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:528)
at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:266)
at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:286)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:104)
... 5 more
Caused by: javax.ejb.EJBException: Bean aoksystems.de/jco~ear*xml|aoksystems.de~jco~ejb.jar*xml|YBPC04_SECOND does not expose RFC access
at com.sap.engine.services.ejb3.runtime.impl.RFCNamingObjectFactory.getObjectInstance(RFCNamingObjectFactory.java:25)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:283)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:464)
Now to describe what I have done:
I created an EAR DC named jco/ear which has a module dependency on an EJB DC named jco/ejb.
DC jco/ejb has a dependency on tc/bl/jrfc/api from SC ENGFACADE, which contains com.sap.mw.jco.*.
I created an EJB YBPC04_SECOND. Checking the four checkboxes for interface generation lead to the creation of:
- class YBPC04_SECONDBean
- interface YBPC04_SECONDLocal
- interface YBPC04_SECONDRemote
- interface YBPC04_SECONDHome
- interface YBPC04_SECONDLocalHome
- interface YBPC04_SECONDLocalComponent
- interface YBPC04_SECONDRemoteComponent
I added a method to both business interfaces and YBPC04_SECONDLocal and YBPC04_SECONDRemote:
@SuppressWarnings("deprecation")
public void processFunction(com.sap.mw.jco.JCO.Function function);
I implemented this method in the bean class YBPC04_SECONDBean, which implements both interfaces:
@SuppressWarnings("deprecation")
public void processFunction(JCO.Function function) {
ParameterList parameterList = new ParameterList();
parameterList.setValue("EV_STRING", "Wert");
function.setExportParameterList(parameterList);
}
In order for the Bean to appear in the JNDI tree in context rfcaccessejb under the name YBPC04_SECOND, I edited the deployments descriptors as follows.
ejb-j2ee-engine.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ejb-j2ee-engine_3_0.xsd">
<enterprise-beans>
<enterprise-bean>
<ejb-name>YBPC04_SECOND</ejb-name>
<jndi-name>YBPC04_SECOND</jndi-name>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
id="ejb-jar_ID" version="3.0">
<enterprise-beans>
<session>
<ejb-name>YBPC04_SECOND</ejb-name>
<ejb-class>de.aoksystems.jco.YBPC04_SECONDBean</ejb-class>
<session-type>Stateless</session-type>
</session>
</enterprise-beans>
</ejb-jar>
This results in my bean showing up in the JNDI tree as follows:
Objektname rfcaccessejb/YBPC04_SECOND
Klassenname javax.naming.Reference
Kontextname rfcaccessejb
Objektwert Reference Class Name: de.aoksystems.jco.YBPC04_SECONDLocalHome
Type: clientAppName
Content: aoksystems.de/jco~ear
Type: interfaceType
Content: local
Type: local-home
Content: de.aoksystems.jco.YBPC04_SECONDLocalHome
Type: ejb-link
Content: YBPC04_SECOND
Type: jndi-name
Content: YBPC04_SECOND
Type: local
Content: de.aoksystems.jco.YBPC04_SECONDLocalComponent
I have configured the JCO RFC Provider as follows:
NWA - Configuration Mgt - Infrastructure - JCO RFC Provider
Program ID: JCOTEST01
Gateway Host: <IP of the ABAP System>
Gateway Service: 33 + system number of the ABAP system
Application Server Host: <IP of the ABAP system>
System number: <system number of the ABAP system>
User: <my user ID on the ABAP system, I have SAP_ALL>
Password: <my pw on the ABAP system>
Language: DE
Local Listeners: checked (local JCO Servers)
(no further settings)
The RFC Destination on the ABAP system is configured as follows:
Destination name: JCO_TEST
Activation type: registered server program
Program ID: JCOTEST01
The JCO RFC Provider is up and running and seems to be working perfectly well. All connection tests from the ABAP system work well.
I have created an RFC enabled function module with a signature as follows:
FUNCTION YBPC04_SECOND.
*"--------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(IV_STRING) TYPE STRING OPTIONAL
*" EXPORTING
*" VALUE(EV_STRING) TYPE STRING
*"--------------------------------------------------------------------
ENDFUNCTION.
I have written a report which calls the function remotely:
REPORT ybpc04_call_second.
DATA:
gv_string TYPE string,
gv_rfc_mess TYPE c LENGTH 1024.
START-OF-SELECTION.
CALL FUNCTION 'YBPC04_SECOND'
DESTINATION 'JCO_TEST'
EXPORTING
iv_string = 'Eingehender String'
IMPORTING
ev_string = gv_string
EXCEPTIONS
system_failure = 1 MESSAGE gv_rfc_mess
communication_failure = 2 MESSAGE gv_rfc_mess.
WRITE: / 'Return code:', AT 20 sy-subrc,
/ 'Message:', AT 20 gv_rfc_mess,
/ 'Result String:', AT 20 gv_string.
I hope very much that you can help me! If you need any more infos, please let me know.
Thanks,
Thorsten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.