RFC Destination does not exist

2019-08-28 06:34发布

问题:

I'm trying to configure an application running in Tomcat 8.5 with Neo Cloud SDK 3.54.23 to connect to an RFC destination and run the following code:

String destinationName = "RFCQueryEndpoint";
ErpConfigContext erpConfigContext = new ErpConfigContext(destinationName);
ErpEndpoint endpoint = new ErpEndpoint(erpConfigContext);
response.getWriter().write(new Gson().toJson(new
             DefaultFinancialTransactionService().getList()
             .execute(endpoint).getListOfSelectedTransactions()));

I have tried multiple ways of configuring the RFC destination, but none of them worked.

I've tried setting a destinations environment variable with:

[{name: "RFCQueryEndpoint", type: "RFC", jco.client.ashost: "host-here", jco.client.client: "100", jco.client.lang: "EN", jco.client.passwd: "pass-here", jco.client.sysnr: "01", jco.client.user: "user-here"}]

I have tried configuring the destination within the server config, as explained in https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/7fa92ffa007346f58491999361928303.html

I have tried creating a file with a .jcoDestination ending and setting the property -Djco.destinations.dir=/home/cassio/jco-destinations but none of them worked.

I'm always getting:

12:20:50.040 [http-nio-8080-exec-4] ERROR  - com.sap.conn.jco.JCoException: (106) JCO_ERROR_RESOURCE: Destination RFCQueryEndpoint does not exist
12:20:50.043 [http-nio-8080-exec-4] ERROR  - com.sap.conn.jco.JCoException: (106) JCO_ERROR_RESOURCE: Destination RFCQueryEndpoint does not exist
com.sap.cloud.sdk.s4hana.connectivity.rfc.exception.RemoteFunctionException: com.sap.conn.jco.JCoException: (106) JCO_ERROR_RESOURCE: Destination RFCQueryEndpoint does not exist
    at com.sap.cloud.sdk.s4hana.connectivity.rfc.JCoRemoteFunctionQueryExecutor.execute(JCoRemoteFunctionQueryExecutor.java:202)
    at com.sap.cloud.sdk.s4hana.connectivity.rfc.JCoRemoteFunctionQueryExecutor.execute(JCoRemoteFunctionQueryExecutor.java:55)
    at com.sap.cloud.sdk.s4hana.connectivity.rfc.BapiQuery.execute(BapiQuery.java:91)
    at com.sap.cloud.sdk.s4hana.datamodel.bapi.functions.DefaultFinancialTransactionGetListFunction.execute(DefaultFinancialTransactionGetListFunction.java:469)
    at MyServlet.doGet(MyServlet.java:77)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextServletFilter$1.execute(RequestContextServletFilter.java:219)
    at com.sap.cloud.sdk.cloudplatform.servlet.Executable.call(Executable.java:23)
    at com.sap.cloud.sdk.cloudplatform.servlet.Executable.call(Executable.java:13)
    at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextCallable.call(RequestContextCallable.java:82)
    at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextServletFilter.doFilter(RequestContextServletFilter.java:221)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.sap.cloud.sdk.cloudplatform.security.servlet.HttpCachingHeaderFilter.doFilter(HttpCachingHeaderFilter.java:56)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.sap.cloud.sdk.cloudplatform.security.servlet.HttpSecurityHeadersFilter.doFilter(HttpSecurityHeadersFilter.java:41)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.filters.RestCsrfPreventionFilter.doFilter(RestCsrfPreventionFilter.java:113)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
    at com.sap.cloud.runtime.impl.bridge.security.AbstractAuthenticator.invoke(AbstractAuthenticator.java:206)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
    at com.sap.core.tenant.valve.TenantValidationValve.invokeNextValve(TenantValidationValve.java:182)
    at com.sap.core.tenant.valve.TenantValidationValve.invoke(TenantValidationValve.java:97)
    at com.sap.js.statistics.tomcat.valve.RequestTracingValve.callNextValve(RequestTracingValve.java:101)
    at com.sap.js.statistics.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:57)
    at com.sap.core.js.monitoring.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:27)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

How can I properly configure an RFC destination locally, using SAP tools for Eclipse, to connect to an S/4 Hana On-Prem system using Neo Cloud SDK + Tomcat?

回答1:

I found what I believe is a workaround.

If I simply set the destination on the server configuration in Eclipse, the SDK finds the destination name but can't find the configuration.

I had to set the destination both in the server config page, as explained here: https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/7fa92ffa007346f58491999361928303.html

And I also had to create the RFCendpoint.jcoDestination file, as follows:

Name=RFCendpoint
Type=RFC
jco.client.client=100
jco.client.lang=EN
jco.client.user=User-here
jco.client.passwd=Password-here
jco.client.ashost=Host-here
jco.client.sysnr=00
jco.destination.pool_capacity=5
jco.destination.peak_limit=10

and pass the directory the file resides in via the -Djco.destinations.dir=/home/cassio/jco-destinations flag in the arguments section of my Run configuration in Eclipse.

With both of these configs I was able to get the SDK to recgonize both the endpoint name and its configuration. Then I was able to use the service as well as call other BAPIs via BapiQuery.



标签: s4sdk