Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Access EJB from SAP system

Former Member
0 Likes
1,005

Hi everyone,

I want to check the feasibility of accessing any EJB deployed on SAP WAS server from the SAP system. Is there any way to call EJB from SAP.

If anybody found splution or any link for this topic then please help me.

Thanks,

Bhavik

Hi everyone,

I want to check the feasibility of accessing any EJB deployed on SAP WAS server from the SAP system. Is there any way to call EJB from SAP.

If anybody found splution or any link for this topic then please help me.

Thanks,

Bhavik

7 REPLIES 7
Read only

Former Member
0 Likes
952

Hi,

Take a look at a previous post submitted in the JAVA Programming Forum.

See if this helps.

Regards

Message was edited by: Shehryar Khan

Read only

Former Member
0 Likes
952

How can i create RFC destination. And I don't know how it works. I don't know which values i have to specify when creating RFC destination. Can anybody explain me the concept behind this. Means how can we access external JAVA program from ABAP.

I went to SM59 transaction and also seen JCO RFC Provider in visual administrator. But i can't understand.

Thanks for your reply in advance.

Bhavik

Read only

Former Member
0 Likes
952

Hi everyone,

I have created RFC destination successfully. And now i can also test that connection through SM59 transaction. I have created one empty function module named ZTEST_EJB. I have created and deployed one stateless session bean and deployed on server. I have specified JNDI name as ZTEST_EJB. But when i am executing ZTEST_EJB function module, i am getting dump with error :

"com.sap.engine.services.rfcengine.RFCException: Incompatible bean type - no "

What is the reason behind this Dump?

Read only

Vlado
Product and Topic Expert
Product and Topic Expert
0 Likes
952

Hi Bhavik,

If your stateless EJB has the method processFunction(com.sap.mw.jco.JCO.Function) in the component interface, then I guess it's a classloader mismatch problem. I'd suggest you to have a look at the following thread:

Hope this helps,

Vladimir

Read only

Former Member
0 Likes
952

Hi,

I gone through that link. All things are proper according to that link. I have corrected as per requirement. Now i am getting another Exception :

"Exception in method processFunction."

Why this dump is coming?

I need to add exception in Function module also.

and if yes then which exception i need to add in function module.

I have added following code in my processFunction method.

JCO.ParameterList input = function.getImportParameterList();

JCO.ParameterList output = function.getExportParameterList();

JCO.ParameterList tables = function.getTableParameterList();

if (function.getName().equals("ZTEST_EJB")) {

output.setValue("This is a response from Example5.java","RESPTEXT");

}

Is it correct?

Thanks,

Bhavik

Read only

Vlado
Product and Topic Expert
Product and Topic Expert
0 Likes
952

Hi Bhavik,

Your code looks fine. Can you paste the whole stack trace of the exception you get? You can find it in the defaultTrace.trc file in /usr/sap/<SID>/<INSTANCE>/j2ee/cluster/server<N>/log.

> I need to add exception in Function module also.

> and if yes then which exception i need to add in function module.

I'm not sure that I understand exactly what you mean with this?

Best regards,

Vladimir

PS: Please consider rewarding points for helpful answers. Thanks.

Read only

Former Member
0 Likes
952

Hi,

I am giving you full exception trace.

#1.5#0002E3563026005100000085000010C40003EFAEEEA3B378#1107959537187#com.sap.engine.services.ejb#sap.com/Test_EJB_app#com.sap.engine.services.ejb#J2EE_GUEST#2##LTI#SAPCUST #E158E308BC5C46A0BA196A7E38427518#SAPEngine_Application_Thread[impl:3]_17##0#0#Error##Java###

[EXCEPTION]

#1#com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method processFunction.

at com.lti.bh.TestABAP.TestEJBLocalLocalObjectImpl0.processFunction(TestEJBLocalLocalObjectImpl0.java:119)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:95)

at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113)

at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:171)

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:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: com.sap.mw.jco.JCO$Exception: (127) JCO_ERROR_FIELD_NOT_FOUND: Field RESPTEXT not a member of OUTPUT

at com.sap.mw.jco.JCO$MetaData.indexOf(JCO.java:8726)

at com.sap.mw.jco.JCO$Record.setValue(JCO.java:14053)

at com.lti.bh.TestABAP.TestEJBBean.processFunction(TestEJBBean.java:44)

at com.lti.bh.TestABAP.TestEJBLocalLocalObjectImpl0.processFunction(TestEJBLocalLocalObjectImpl0.java:103)

... 11 more

com.sap.mw.jco.JCO$Exception: (127) JCO_ERROR_FIELD_NOT_FOUND: Field RESPTEXT not a member of OUTPUT

at com.sap.mw.jco.JCO$MetaData.indexOf(JCO.java:8726)

at com.sap.mw.jco.JCO$Record.setValue(JCO.java:14053)

at com.lti.bh.TestABAP.TestEJBBean.processFunction(TestEJBBean.java:44)

at com.lti.bh.TestABAP.TestEJBLocalLocalObjectImpl0.processFunction(TestEJBLocalLocalObjectImpl0.java:103)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:95)

at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113)

at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:171)

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:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

#

#1.5#0002E3563026006000000048000010C40003EFAEEEA3BA54#1107959537187#com.sap.engine.services.rfcengine##com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal()####LTI#SAPCUST #E158E308BC5C46A0BA196A7E38427518#Thread[JCO.ServerThread-1,10,SAPEngine_System_Thread[impl:5]_Group]##0#0#Error##Plain###com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method processFunction.#

#1.5#0002E3563026006000000049000010C40003EFAEEEA3BAFB#1107959537187#com.sap.engine.services.rfcengine##com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal()####LTI#SAPCUST #E158E308BC5C46A0BA196A7E38427518#Thread[JCO.ServerThread-1,10,SAPEngine_System_Thread[impl:5]_Group]##0#0#Error##Plain###com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method processFunction.

at com.lti.bh.TestABAP.TestEJBLocalLocalObjectImpl0.processFunction(TestEJBLocalLocalObjectImpl0.java:119)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:95)

at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113)

at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:171)

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:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: com.sap.mw.jco.JCO$Exception: (127) JCO_ERROR_FIELD_NOT_FOUND: Field RESPTEXT not a member of OUTPUT

at com.sap.mw.jco.JCO$MetaData.indexOf(JCO.java:8726)

at com.sap.mw.jco.JCO$Record.setValue(JCO.java:14053)

at com.lti.bh.TestABAP.TestEJBBean.processFunction(TestEJBBean.java:44)

at com.lti.bh.TestABAP.TestEJBLocalLocalObjectImpl0.processFunction(TestEJBLocalLocalObjectImpl0.java:103)

... 11 more

com.sap.mw.jco.JCO$Exception: (127) JCO_ERROR_FIELD_NOT_FOUND: Field RESPTEXT not a member of OUTPUT

at com.sap.mw.jco.JCO$MetaData.indexOf(JCO.java:8726)

at com.sap.mw.jco.JCO$Record.setValue(JCO.java:14053)

at com.lti.bh.TestABAP.TestEJBBean.processFunction(TestEJBBean.java:44)

at com.lti.bh.TestABAP.TestEJBLocalLocalObjectImpl0.processFunction(TestEJBLocalLocalObjectImpl0.java:103)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:95)

at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113)

at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:171)

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:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

#

I have checked RESPTEXT parameter. It is in export parameter in FM.

And i was asking about whether i have to add any exception in FM or not???