【发布时间】: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