SAP / cloud-sdk-java

Use the SAP Cloud SDK for Java to reduce development effort when building applications on SAP Business Technology Platform that communicate with SAP solutions and services such as SAP S/4HANA Cloud, SAP SuccessFactors, and many others.
Apache License 2.0
22 stars 14 forks source link

Error "Failed to get destination with name" when running local or in BAS #380

Closed gregorwolf closed 8 months ago

gregorwolf commented 8 months ago

Issue Description

I try to upgrade the Java part of my BTP connectivity test application HTML5UserAPIforCF. For that I've started from scratch and generated a Spring Boot project following the steps in the Getting started guide. You can find this project at sap-cloud-sdk-rfc. I've added the functionality to call a RFC Module following the documentation Call a BAPI/RFC Module. Before deploying to BTP Cloud Foundry I try to test local following Local Deployment. Here are my concrete steps before starting the app:

I've created a file called /home/user/SAP_ABAP_BACKEND_RFC.jcoDestination with the following content:

jco.client.ashost=vhcala4hci.dummy.nodomain jco.client.sysnr=00 jco.client.client=001 jco.client.user=DEVELOPER jco.client.passwd= jco.client.lang=en

the path /home/user is also defined in the code RfcController.java#L29.

Then I run:

export destinations="[{name: \"SAP_ABAP_BACKEND_RFC\"}]"

to provide this destination. Then I run:

cd application/
mvn spring-boot:run -D"spring-boot.run.profiles"=local

When then accessing http://localhost:8080/rfc I see the following error in the console:

2024-03-29T16:45:40.989Z  INFO 5855 --- [nio-8080-exec-1] rfctest.controllers.RfcController        : I am running!
2024-03-29T16:45:40.989Z  INFO 5855 --- [nio-8080-exec-1] rfctest.controllers.RfcController        : destinations: [{name: "SAP_ABAP_BACKEND_RFC"}]
2024-03-29T16:45:40.999Z  INFO 5855 --- [nio-8080-exec-1] c.s.c.s.c.c.DestinationAccessor          : Creating a new DestinationLoaderChain with class com.sap.cloud.sdk.cloudplatform.connectivity.EnvVarDestinationLoader as the primary interface com.sap.cloud.sdk.cloudplatform.connectivity.DestinationLoader implementation.
2024-03-29T16:45:41.009Z  INFO 5855 --- [nio-8080-exec-1] c.s.c.s.c.c.DestinationAccessor          : Using an instance of class com.sap.cloud.sdk.cloudplatform.connectivity.DestinationService as the secondary interface com.sap.cloud.sdk.cloudplatform.connectivity.DestinationLoader implementation.
2024-03-29T16:45:41.036Z  WARN 5855 --- [nio-8080-exec-1] c.s.c.s.c.s.RequestAccessorFilter        : Unexpected servlet filter exception: jakarta.servlet.ServletException: Request processing failed: com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException: Failed to get destination with name 'SAP_ABAP_BACKEND_RFC'.

com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextExecutionException: jakarta.servlet.ServletException: Request processing failed: com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException: Failed to get destination with name 'SAP_ABAP_BACKEND_RFC'.
        at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextExecutor.execute(ThreadContextExecutor.java:272)
        at com.sap.cloud.sdk.cloudplatform.servletjakarta.RequestAccessorFilter.doFilter(RequestAccessorFilter.java:60)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
        at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:735)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:833)

Impact / Priority

Affected development phase: Production

Impact: Blocked

Maven Dependency Tree

[INFO] rfctest:rfctest-application:jar:1.0-SNAPSHOT
[INFO] +- com.sap.cloud.sdk:sdk-core:jar:5.6.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity:jar:5.6.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:resilience-api:jar:5.6.0:compile
[INFO] |  |  +- com.sap.cloud.environment.servicebinding.api:java-core-api:jar:0.10.4:compile
[INFO] |  |  +- com.sap.cloud.environment.servicebinding.api:java-access-api:jar:0.10.4:compile
[INFO] |  |  +- org.slf4j:jcl-over-slf4j:jar:2.0.9:runtime
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.17.0:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-core:jar:2.17.0:compile
[INFO] |  |  |  \- net.bytebuddy:byte-buddy:jar:1.14.10:compile
[INFO] |  |  +- org.apache.commons:commons-lang3:jar:3.14.0:compile
[INFO] |  |  +- com.auth0:java-jwt:jar:4.4.0:compile
[INFO] |  |  +- org.bouncycastle:bcprov-jdk18on:jar:1.77:compile
[INFO] |  |  \- org.bouncycastle:bcpkix-jdk18on:jar:1.77:compile
[INFO] |  |     \- org.bouncycastle:bcutil-jdk18on:jar:1.77:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:connectivity-destination-service:jar:5.6.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:connectivity-apache-httpclient4:jar:5.6.0:compile
[INFO] |  |  +- com.github.ben-manes.caffeine:caffeine:jar:3.1.8:compile
[INFO] |  |  +- commons-io:commons-io:jar:2.15.1:compile
[INFO] |  |  +- org.apache.httpcomponents:httpclient:jar:4.5.14:compile
[INFO] |  |  |  \- commons-codec:commons-codec:jar:1.16.0:compile
[INFO] |  |  \- com.sap.cloud.environment.servicebinding.api:java-consumption-api:jar:0.10.4:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:connectivity-oauth:jar:5.6.0:compile
[INFO] |  |  +- com.sap.cloud.security.xsuaa:token-client:jar:3.3.5:compile
[INFO] |  |  +- com.sap.cloud.security:java-api:jar:3.3.5:compile
[INFO] |  |  \- com.sap.cloud.security:java-security:jar:3.3.5:runtime
[INFO] |  |     \- com.sap.cloud.security:env:jar:3.3.5:runtime
[INFO] |  |        +- com.sap.cloud.environment.servicebinding:java-sap-vcap-services:jar:0.10.4:runtime
[INFO] |  |        \- com.sap.cloud.environment.servicebinding:java-sap-service-operator:jar:0.10.4:runtime
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core:jar:5.6.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:servlet-jakarta:jar:5.6.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:tenant:jar:5.6.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:security:jar:5.6.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:resilience:jar:5.6.0:compile
[INFO] |  |  \- com.sap.cloud.sdk.cloudplatform:resilience4j:jar:5.6.0:compile
[INFO] |  |     +- io.github.resilience4j:resilience4j-circuitbreaker:jar:2.2.0:compile
[INFO] |  |     |  \- io.github.resilience4j:resilience4j-core:jar:2.2.0:compile
[INFO] |  |     +- io.github.resilience4j:resilience4j-bulkhead:jar:2.2.0:compile
[INFO] |  |     +- io.github.resilience4j:resilience4j-timelimiter:jar:2.2.0:compile
[INFO] |  |     +- io.github.resilience4j:resilience4j-retry:jar:2.2.0:compile
[INFO] |  |     +- io.github.resilience4j:resilience4j-ratelimiter:jar:2.2.0:compile
[INFO] |  |     \- javax.cache:cache-api:jar:1.1.1:compile
[INFO] |  \- com.sap.cloud.sdk.cloudplatform:caching:jar:5.6.0:compile
[INFO] +- com.sap.cloud.sdk.s4hana:rfc:jar:5.6.0:compile
[INFO] |  +- com.sap.cloud.sdk.s4hana:s4hana-core:jar:5.6.0:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.17.0:compile
[INFO] |  +- com.sap.cloud.sdk.s4hana:s4hana-connectivity:jar:5.6.0:compile
[INFO] |  +- com.sap.cloud.sdk.datamodel:fluent-result:jar:5.6.0:compile
[INFO] |  +- io.vavr:vavr:jar:0.10.4:compile
[INFO] |  |  \- io.vavr:vavr-match:jar:0.10.4:compile
[INFO] |  +- com.google.guava:guava:jar:33.1.0-jre:compile
[INFO] |  |  +- com.google.guava:failureaccess:jar:1.0.2:compile
[INFO] |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  |  +- org.checkerframework:checker-qual:jar:3.42.0:compile
[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.26.1:compile
[INFO] |  |  \- com.google.j2objc:j2objc-annotations:jar:3.0.0:compile
[INFO] |  +- org.json:json:jar:20240303:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.10.1:compile
[INFO] |  +- com.mikesamuel:json-sanitizer:jar:1.2.3:compile
[INFO] |  \- org.apache.httpcomponents:httpcore:jar:4.4.16:compile
[INFO] +- org.slf4j:slf4j-api:jar:2.0.12:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.4.11:compile
[INFO] |  \- ch.qos.logback:logback-core:jar:1.4.11:compile
[INFO] +- com.sap.hcp.cf.logging:cf-java-logging-support-logback:jar:3.7.1:compile
[INFO] |  \- com.sap.hcp.cf.logging:cf-java-logging-support-core:jar:3.7.1:compile
[INFO] |     \- com.fasterxml.jackson.jr:jackson-jr-objects:jar:2.15.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:3.2.0:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:3.2.0:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:3.2.0:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.21.1:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.21.1:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:2.0.9:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:2.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:3.2.0:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.15.3:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.17.0:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.15.3:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:3.2.0:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:10.1.16:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:10.1.16:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:10.1.16:compile
[INFO] |  +- org.springframework:spring-web:jar:6.1.1:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:6.1.1:compile
[INFO] |  |  \- io.micrometer:micrometer-observation:jar:1.12.0:compile
[INFO] |  |     \- io.micrometer:micrometer-commons:jar:1.12.0:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:6.1.1:compile
[INFO] |     +- org.springframework:spring-aop:jar:6.1.1:compile
[INFO] |     +- org.springframework:spring-context:jar:6.1.1:compile
[INFO] |     \- org.springframework:spring-expression:jar:6.1.1:compile
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.0:test
[INFO] |  +- org.opentest4j:opentest4j:jar:1.3.0:test
[INFO] |  +- org.junit.platform:junit-platform-commons:jar:1.10.0:test
[INFO] |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] +- org.springframework:spring-test:jar:6.1.1:test
[INFO] |  \- org.springframework:spring-core:jar:6.1.1:compile
[INFO] |     \- org.springframework:spring-jcl:jar:6.1.1:compile
[INFO] +- org.springframework.boot:spring-boot-test:jar:3.2.0:test
[INFO] |  \- org.springframework.boot:spring-boot:jar:3.2.0:compile
[INFO] +- org.springframework.boot:spring-boot-test-autoconfigure:jar:3.2.0:test
[INFO] |  \- org.springframework.boot:spring-boot-autoconfigure:jar:3.2.0:compile
[INFO] +- org.springframework.security:spring-security-test:jar:6.2.0:test
[INFO] |  +- org.springframework.security:spring-security-core:jar:6.2.0:test
[INFO] |  |  \- org.springframework.security:spring-security-crypto:jar:6.2.0:test
[INFO] |  \- org.springframework.security:spring-security-web:jar:6.2.0:test
[INFO] \- org.skyscreamer:jsonassert:jar:1.5.1:test

Checklist

MatKuhr commented 8 months ago

Hi Gregor, I think the issue might be that that your destination is

  1. malformed JSON
  2. lacking the RFC type

Instead, try:

export destinations='[{"name": "SAP_ABAP_BACKEND_RFC", "type": "RFC"}]'

If this doesn't fix it please double check you are attaching the full stack trace. The above one seems to be cut off, it doesn't include the actual cause of DestinationAccessException.

Finally, please note though that the RFC functionality is deprecated and may be removed in future versions.

gregorwolf commented 8 months ago

Hi @MatKuhr,

thank you for the tip to add the type. This should be quickly corrected in Set Destination as Environment Variable. I run now into the next error:

com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextExecutionException: jakarta.servlet.ServletException: Handler dispatch failed: java.lang.NoClassDefFoundError: com/sap/conn/jco/JCoException

maybe you also have a tip here. Where does the command:

mvn install:install-file -Dfile=sapjco3.jar -DgroupId=com.sap.conn.jco -DartifactId=com.sap.conn.jco.sapjco3 -Dversion=3.1.9 -Dpackaging=jar

be run in?

MatKuhr commented 8 months ago

corrected in Set Destination as Environment Variable.

Thanks, fixed with this PR 😉

Where does the command

I don't quite get the question.. In any terminal where you would run any command basically?

In the end you need to have the JAR file locally on your file system and install in into the .m2/repository directory where Maven stores your dependencies locally. How that exactly works on BAS I'm not sure, but I'd think it works equally as on your local machine..

gregorwolf commented 8 months ago

Hi @MatKuhr ,

we're making progress. I've checked my local .m2/repository/ folder and found:

➜  ~ ls -la .m2/repository/com/sap/conn/jco/com.sap.conn.jco.sapjco3/3.1.9 
total 3160
drwxr-xr-x  5 gwolf  staff      160 Mar 29 11:23 .
drwxr-xr-x  5 gwolf  staff      160 Mar 28 17:08 ..
-rw-r--r--  1 gwolf  staff      215 Apr  2 13:56 _remote.repositories
-rw-r--r--  1 gwolf  staff  1607913 Mar 19 18:34 com.sap.conn.jco.sapjco3-3.1.9.jar
-rw-r--r--  1 gwolf  staff      485 Mar 28 17:08 com.sap.conn.jco.sapjco3-3.1.9.pom

I've updated my sample repository sap-cloud-sdk-rfc for my local environment and enabled the JCo. But now I get this exception:

Unexpected servlet filter exception: jakarta.servlet.ServletException: Handler dispatch failed: java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path: /Users/gwolf/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.

com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextExecutionException: jakarta.servlet.ServletException: Handler dispatch failed: java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path: /Users/gwolf/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
        at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextExecutor.execute(ThreadContextExecutor.java:272)
        at com.sap.cloud.sdk.cloudplatform.servletjakarta.RequestAccessorFilter.doFilter(RequestAccessorFilter.java:60)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
        at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: jakarta.servlet.ServletException: Handler dispatch failed: java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path: /Users/gwolf/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1104)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
        at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
        at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
        at com.sap.cloud.sdk.cloudplatform.servletjakarta.RequestAccessorFilter.lambda$doFilter$0(RequestAccessorFilter.java:60)
        at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextExecutor.lambda$execute$1(ThreadContextExecutor.java:264)
        at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextExecutor.call(ThreadContextExecutor.java:297)
        at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextExecutor.execute(ThreadContextExecutor.java:263)
        ... 31 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path: /Users/gwolf/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
        at com.sap.conn.jco.rt.Middleware.<clinit>(Middleware.java:89)
        at com.sap.conn.jco.rt.JCoRuntime.setMiddlewarePropertyValue(JCoRuntime.java:1765)
        at com.sap.conn.jco.rt.DefaultJCoRuntime.initialize(DefaultJCoRuntime.java:88)
        at com.sap.conn.jco.rt.JCoRuntimeFactory.<clinit>(JCoRuntimeFactory.java:23)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:421)
        at java.base/java.lang.Class.forName(Class.java:412)
        at com.sap.conn.jco.JCo.createJCo(JCo.java:37)
        at com.sap.conn.jco.JCo.<clinit>(JCo.java:28)
        at com.sap.conn.jco.JCoDestinationManager.getDestination(JCoDestinationManager.java:56)
        at com.sap.cloud.sdk.s4hana.connectivity.rfc.JCoTransaction.<init>(JCoTransaction.java:96)
        at com.sap.cloud.sdk.s4hana.connectivity.rfc.RfmTransactionFactory.createJCoTransaction(RfmTransactionFactory.java:34)
        at com.sap.cloud.sdk.s4hana.connectivity.rfc.AbstractTransactionFactory.createTransaction(AbstractTransactionFactory.java:38)
        at com.sap.cloud.sdk.s4hana.connectivity.rfc.RemoteFunctionRequestExecutor.execute(RemoteFunctionRequestExecutor.java:42)
        at com.sap.cloud.sdk.s4hana.connectivity.rfc.RfmRequest.execute(RfmRequest.java:85)
        at rfctest.controllers.RfcController.getHello(RfcController.java:40)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:254)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:182)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:917)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:829)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
        ... 46 common frames omitted

It seems to me that the DYLD_LIBRARY_PATH variable that I've configured:

➜  application git:(main) ✗ echo $DYLD_LIBRARY_PATH
/Users/gwolf/Downloads/sapjco3-darwinintel64-3.1.9

isn't picked up correctly.

MatKuhr commented 8 months ago

Okay, that seems to be an error thrown by JCo itself. I don't know what the exact instructions for your OS are, maybe the setup has changed since our guide was written. Thus the guide refers to the installation.html file you get when downloading JCo.

So please raise a ticket on support.sap.com on the component BC-MID-CON-JCO to get help on this.

I'll close this issue for now, but please feel free to still comment here and if you have further questions or issues related to the Cloud SDK itself then I'll just re-open 😉

gregorwolf commented 8 months ago

Hi @MatKuhr ,

the JCo itself works on my Mac OS (Intel) system. In the JCo subfolder examples I can run:

java com.sap.conn.jco.examples.client.beginner.CallUsingStructure                

and get the output:

System info for A4H:

RFCPROTO:   011
RFCCHARTYP: 4103
RFCINTTYP:  LIT
RFCFLOTYP:  IE3
RFCDEST:    vhcala4hci_A4H_00
RFCHOST:    vhcala4h
RFCSYSID:   A4H
RFCDATABS:  A4H
RFCDBHOST:  vhcala4hci
RFCDBSYS:   HDB
RFCSAPRL:   757
RFCMACH:      390
RFCOPSYS:   Linux
RFCTZONE:        0
RFCDAYST:   
RFCIPADDR:  172.17.0.2
RFCKERNRL:  789
RFCHOST2:   vhcala4hci
RFCSI_RESV: 
RFCIPV6ADDR:    172.17.0.2

It would be great if someone from the Cloud SDK Team can check if the documentation still works.

MatKuhr commented 8 months ago

Not sure how you ran it exactly, but it needs to be available to the application you are running. Not related to Cloud SDK and not anything we can help with, sorry.