【问题标题】:Problems with JCO on SAP Cloud Platform (Cloud Foundry)SAP Cloud Platform (Cloud Foundry) 上的 JCO 问题
【发布时间】:2019-09-09 15:25:41
【问题描述】:

我想在使用 JCO 连接到后端系统的 SCP CF 上运行 Sprint Boot 组件。我有一个使用 SCP NEO 的有效解决方案,但是使用 SCP CF 我得到一个运行时错误。

最初我在 SCP NEO 堆栈上使用 JCO 创建了一个 Spring Boot Java 组件。一切正常。在第二步中,我想将组件迁移到 SCP 的 Cloud Foundry 堆栈。因此,a 做了必要的配置(目的地等)并将组件部署在 SCP CF 堆栈上。我能够部署我的组件并通过 Postman 调用 REST 服务,但在内部,当我尝试连接到配置的后端目标时,出现运行时错误 当我尝试创建 JCODestination 时出现“java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path”

JCO 库似乎没有到位。我是否必须在 SCP CF 中明确定义 JCO 库?如果是,这是如何完成的?如前所述,在 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;
}

错误日志显示:

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)

【问题讨论】:

    标签: cloud-foundry jco


    【解决方案1】:

    对于 SAP Cloud Platforms (Neo + Cloud Foundry),您不能使用 JCo Standalone,但您必须使用能够通过 SAP Cloud Connector 进行通信的已经嵌入/集成的 JCo 版本。 但是 CF 环境的 SAP Java buildpack 附带的 JCo 不能与 Spring Boot 应用程序一起使用:
    查看列出的限制here:

    不能将 SAP Java 连接器与 Spring Boot 一起使用 应用程序。

    所以我担心你想要达到的目标是不可能的。 Neo 云平台不存在此限制,这似乎是您在那里没有任何问题的原因。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-26
      • 1970-01-01
      • 1970-01-01
      • 2018-09-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多