简体   繁体   English

SAP Cloud Platform(Cloud Foundry)上的JCO问题

[英]Problems with JCO on SAP Cloud Platform (Cloud Foundry)

I want to run a Sprint Boot component on SCP CF that uses JCO to connect to a backend system. 我想在SCP CF上运行一个Sprint Boot组件,该组件使用JCO连接到后端系统。 I have a working solution with SCP NEO, but with SCP CF I get a runtime error. 我使用SCP NEO有一个可行的解决方案,但是使用SCP CF我遇到了运行时错误。

Originally I created a Spring Boot Java component using JCO on SCP NEO stack. 最初,我在SCP NEO堆栈上使用JCO创建了Spring Boot Java组件。 Everything works fine with that. 一切正常。 In a second step I wanted to migrate the component to the Cloud Foundry stack of the SCP. 在第二步中,我想将组件迁移到SCP的Cloud Foundry堆栈。 Therefore a did the necessary configuration (destinations etc) and deployed the component on the SCP CF stack. 因此,做了必要的配置(目的地等)并将组件部署在SCP CF堆栈上。 I was able to deploy my component and call the REST service via Postman but internally when I try to connect to the configured backend destination I get an runtime error "java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path" when I try to create a JCODestination 我能够部署我的组件并通过Postman调用REST服务,但是当我尝试连接到配置的后端目标时在内部却遇到了运行时错误“ java.lang.UnsatisfiedLinkError:java.library.path中没有sapjco3”创建一个JCODestination

Seems that the JCO library is not in place. 似乎没有JCO库。 Do I have to explecitely define the JCO library in SCP CF? 我是否必须在SCP CF中明确定义JCO库? If yes, how is this done? 如果是,该怎么做? As said, under SCP NEO I didn't get such errors... 如前所述,在SCP NEO之下我没有得到这样的错误...

public JCoDestination getJcoDestination(String target, String jcoDestinationName) {

  JCoDestination jcoDestination = null;
  try {
    jcoDestination = JCoDestinationManager.getDestination(jcoDestinationName);
  } catch (JCoException e) {
    throw new RuntimeException("Unable to create/read the destination files, target="+target+",      
    destinationName="+jcoDestinationName, e);
  }

  return jcoDestination;
}

The error log shows: 错误日志显示:

java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1966)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1134)
    at com.sap.conn.jco.rt.DefaultJCoRuntime.loadJCoLibrary(DefaultJCoRuntime.java:898)
    at com.sap.conn.jco.rt.DefaultJCoRuntime.registerNativeMethods(DefaultJCoRuntime.java:467)
    at com.sap.conn.jco.rt.JCoRuntime.registerNatives(JCoRuntime.java:1554)
    at com.sap.conn.rfc.driver.CpicDriver.<clinit>(CpicDriver.java:885)
    at com.sap.conn.rfc.engine.DefaultRfcRuntime.getVersion(DefaultRfcRuntime.java:36)
    at com.sap.conn.rfc.api.RfcApi.RfcGetVersion(RfcApi.java:236)
    at com.sap.conn.jco.rt.MiddlewareJavaRfc.<clinit>(MiddlewareJavaRfc.java:214)
    at com.sap.conn.jco.rt.DefaultJCoRuntime.initialize(DefaultJCoRuntime.java:98)
    at com.sap.conn.jco.rt.JCoRuntimeFactory.<clinit>(JCoRuntimeFactory.java:23)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forNameFW(Class.java:362)
    at java.lang.Class.forName(Class.java:270)
    at com.sap.conn.jco.JCo.createJCo(JCo.java:52)
    at com.sap.conn.jco.JCo.<clinit>(JCo.java:26)
    at com.sap.conn.jco.JCoDestinationManager.getDestination(JCoDestinationManager.java:104)

For the SAP Cloud Platforms (Neo + Cloud Foundry) you cannot use JCo Standalone but you have to use the already embedded/integrated JCo version which is capable to communicate via the SAP Cloud Connector. 对于SAP Cloud平台(Neo + Cloud Foundry),您不能使用JCo Standalone,但必须使用能够通过SAP Cloud Connector进行通信的已嵌入/集成的JCo版本。 But the JCo which comes with the SAP Java buildpack for the CF environment cannot be used with Spring Boot applications: 但是,针对CF环境的SAP Java buildpack附带的JCo不能与Spring Boot应用程序一起使用:
See the limitations listed here : 请参阅此处列出的限制:

It is not possible to use the SAP Java Connector with Spring Boot applications. SAP Java Connector无法与Spring Boot应用程序一起使用。

So I am afraid that what you are trying to achieve is not possible. 因此,恐怕您试图实现的目标是不可能的。 This limitation does not exist for the Neo cloud platform and seems to be the reason why you do not have any issues there. Neo云平台不存在此限制,这似乎是在那里没有任何问题的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM