英文:
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
[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
[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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论