Error while running the application for CAP Java

209 Views Asked by At

We get the error while ruuning the application for my java application we are using SAP Cloud SDK :-

Error creating bean with name 'com.sap.cds.framework.spring.config.runtime.CdsRuntimeInitializer': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/sap/cloud/sdk/cloudplatform/CfPlatformSslContextProvider

Below is our parent Pom for for the cloud sdk

        <dependency>
            <groupId>com.sap.cloud.sdk</groupId>
            <artifactId>sdk-bom</artifactId>
            <version>4.20.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>

And for the src/pom.xml

    <dependency>
        <groupId>com.sap.cloud.sdk.cloudplatform</groupId>
        <artifactId>scp-cf</artifactId>
        <version>4.2.0</version>
    </dependency>
    <dependency>
        <groupId>com.sap.cloud.sdk.s4hana</groupId>
        <artifactId>s4hana-all</artifactId>
    </dependency>A
    <dependency>
            <groupId>com.sap.cds</groupId>
            <artifactId>cds-integration-cloud-sdk</artifactId>
    </dependency>

Can you please help me out to understand what im missing here.

1

There are 1 best solutions below

1
Manish Nandamudi On

It worked when I used the below in the main java spring boot file

@ComponentScan({"com.sap.cloud.sdk", <your.own.package>})
@ServletComponentScan({"com.sap.cloud.sdk", <your.own.package>})

Adding the dependencies in srv/pom.xml

<dependency>
    <groupId>com.sap.cloud.sdk.cloudplatform</groupId>
    <artifactId>scp-cf</artifactId>
</dependency>

<dependency>
    <groupId>com.sap.cloud.sdk.s4hana</groupId>
    <artifactId>s4hana-all</artifactId>
</dependency>

In the main parent pom

<dependency>
    <groupId>com.sap.cloud.sdk</groupId>
    <artifactId>sdk-bom</artifactId>
    <version>4.21.0</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>