NoClassDefFoundError在使用Maven Spring Boot应用程序SAP CF中使用SAP JCo时发生。

huangapple go评论88阅读模式
英文:

NoClassDefFoundError while using SAP JCo in maven Sprinboot Application SAP CF

问题

I am getting below error while trying to use sapjco3 in my Springboot application. I am deploying my application to SAP Cloud foundry environment packaging as war file with tomee7 TARGET_RUNTIME

java.lang.NoClassDefFoundError: com/sap/conn/jco/JCo : cannot initialize class because prior initialization attempt failed]

while adding the dependency from maven it is packaging the sapjco jar with following name and getting below error

java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path:[/usr/java/packages/lib/amd64, /usr/lib64, /lib64, /lib, /usr/lib] and in system

NoClassDefFoundError在使用Maven Spring Boot应用程序SAP CF中使用SAP JCo时发生。

[https://sap.github.io/cloud-sdk/docs/java/features/bapi-and-rfc/overview]

I have packaged the springboot as war instead of jar to resolve the sapjco dependency

https://sap.github.io/cloud-sdk/docs/java/guides/spring-boot-war-deployment

英文:

​I am getting below error while trying to use sapjco3 in my Springboot application. I am deploying my application to SAP Cloud foundry environment packaging as war file with tomee7 TARGET_RUNTIME

> java.lang.NoClassDefFoundError: com/sap/conn/jco/JCo : cannot initialize class because prior initialization attempt failed]","level":"ERROR"

while adding the dependency from maven it is packaging the sapjco jar with following name and getting below error
> java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path:[/usr/java/packages/lib/amd64, /usr/lib64, /lib64, /lib, /usr/lib] and in system

NoClassDefFoundError在使用Maven Spring Boot应用程序SAP CF中使用SAP JCo时发生。

[https://sap.github.io/cloud-sdk/docs/java/features/bapi-and-rfc/overview]

I have packaged the springboot as war instead of jar to resolve the sapjco dependency

https://sap.github.io/cloud-sdk/docs/java/guides/spring-boot-war-deployment

答案1

得分: 1

Change the scope of the dependency to provided as described in the documentation. SAP Java buildpack already includes a JCo runtime fitting to the Cloud Foundry environment. (credit to Markus who answered this originally here).

For more information on how to manage dependencies provided by the SAP Java Buildpack please refer to the dedicated guide here.

英文:

Change the scope of the dependency to provided as described in the documentation. SAP Java buildpack already includes a JCo runtime fitting to the Cloud Foundry environment. (credit to Markus who answered this originally here).

For more information on how to manage dependencies provided by the SAP Java Buildpack please refer to the dedicated guide here.

huangapple
  • 本文由 发表于 2023年5月10日 17:02:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76216639.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定