SAP / cloud-sdk-java

Use the SAP Cloud SDK for Java to reduce development effort when building applications on SAP Business Technology Platform that communicate with SAP solutions and services such as SAP S/4HANA Cloud, SAP SuccessFactors, and many others.
Apache License 2.0
22 stars 14 forks source link

Spring Security with xsuaa instance giving ShouldNotHappenException #299

Closed abhishekp1254 closed 9 months ago

abhishekp1254 commented 9 months ago

Issue Description

While Spring Security with xsuaa instance , it is unable to get the tenant information.

Below is the code of Security Configuration:

@Autowired
    XsuaaServiceConfiguration xsuaaServiceConfiguration;
@Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        // @formatter:off
        http
                .sessionManagement(session -> session
                        .sessionCreationPolicy(SessionCreationPolicy.STATELESS))
                .authorizeHttpRequests(authz ->
                        authz.requestMatchers("/v1/sayHello").hasAuthority("Read")
                                .requestMatchers("/v1/**").authenticated()
                                .requestMatchers("/v2/**").hasAuthority("Read")
                                .requestMatchers("/v3/**").hasAuthority("Read")
                                .requestMatchers("/v3/requestRefreshToken/*").hasAuthority("Read")
                                .requestMatchers("/health").permitAll()
                                .requestMatchers("/SalesOrders/**").permitAll()
                                .anyRequest().denyAll()
                )
                .oauth2ResourceServer(oauth2 -> oauth2
                        .jwt(jwt -> jwt
                                .jwtAuthenticationConverter(getJwtAuthenticationConverter())));

        return http.build();
    }
    Converter<Jwt, AbstractAuthenticationToken> getJwtAuthenticationConverter() {
        TokenAuthenticationConverter converter = new TokenAuthenticationConverter(xsuaaServiceConfiguration);
        converter.setLocalScopeAsAuthorities(true);
        return converter;

Impact / Priority

We are migrating our app from tomee 7 with java 8 to spring boot and java 17.

Affected development phase: e.g. Getting Started, Development, Release, Production

Impact: Blocked

Error Message

{"msg":"Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception","level":"ERROR","written_ts":"1707809245639807820","logger":"org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]","exception_type":"com.sap.cloud.sdk.cloudplatform.exception.ShouldNotHappenException","written_at":"2024-02-13T07:27:25.639Z","thread":"http-nio-8080-exec-10","type":"log","exception_message":"java.lang.NoClassDefFoundError: Could not initialize class com.sap.cloud.sdk.cloudplatform.servlet.RequestContextAccessor","stacktrace":["com.sap.cloud.sdk.cloudplatform.exception.ShouldNotHappenException: java.lang.NoClassDefFoundError: Could not initialize class com.sap.cloud.sdk.cloudplatform.servlet.RequestContextAccessor","
    at com.sap.cloud.sdk.cloudplatform.servletjakarta.RequestAccessorFilter.doFilter(RequestAccessorFilter.java:64)","
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)","
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)","
    at org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$3(FilterChainProxy.java:231)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:365)","
    at org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:100)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)","
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:131)","
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:85)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:179)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.oauth2.server.resource.web.authentication.BearerTokenAuthenticationFilter.doFilterInternal(BearerTokenAuthenticationFilter.java:145)","
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107)","
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:117)","
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)","
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)","
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)","
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:82)","
    at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:69)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62)","
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)","
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)","
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)","
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:233)","
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:191)","
    at org.springframework.security.web.debug.DebugFilter.invokeWithWrappedRequest(DebugFilter.java:90)","
    at org.springframework.security.web.debug.DebugFilter.doFilter(DebugFilter.java:78)","
    at org.springframework.security.web.debug.DebugFilter.doFilter(DebugFilter.java:67)","
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:352)","
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:268)","
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)","
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)","
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)","
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)","
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)","
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)","
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)","
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)","
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)","
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)","
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)","
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)","
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)","
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)","
    at org.cloudfoundry.router.jakarta.ClientCertificateMapper.doFilter(ClientCertificateMapper.java:79)","
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)","
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)","
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)","
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)","
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)","
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)","
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)","
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)","
    at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:735)","
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340)","
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391)","
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)","
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)","
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744)","
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)","
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)","
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)","
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)","
    at java.base/java.lang.Thread.run(Unknown Source)","Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sap.cloud.sdk.cloudplatform.servlet.RequestContextAccessor","
    at com.sap.cloud.sdk.cloudplatform.tenant.AbstractTenantFacade.getCurrentTenantIfAvailable(AbstractTenantFacade.java:100)","
    at io.vavr.control.Try.of(Try.java:75)","
    at com.sap.cloud.sdk.cloudplatform.tenant.AbstractTenantFacade.tryGetCurrentTenant(AbstractTenantFacade.java:158)","
    at com.sap.cloud.sdk.cloudplatform.tenant.TenantAccessor.tryGetCurrentTenant(TenantAccessor.java:135)","
    at com.sap.cloud.sdk.cloudplatform.tenant.TenantAccessor.getCurrentTenant(TenantAccessor.java:101)","
    at io.vavr.control.Try.of(Try.java:75)","
    at io.vavr.control.Try.ofCallable(Try.java:105)","
    at com.sap.cloud.sdk.cloudplatform.thread.Property.lambda$decorateCallable$1(Property.java:135)","
    at com.sap.cloud.sdk.cloudplatform.thread.ThreadContext.setPropertyIfAbsent(ThreadContext.java:70)","
    at com.sap.cloud.sdk.cloudplatform.tenant.TenantThreadContextListener.afterInitialize(TenantThreadContextListener.java:63)","
    at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextExecutor.notifyAfterInitialize(ThreadContextExecutor.java:321)","
    at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextExecutor.call(ThreadContextExecutor.java:294)","
    at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextExecutor.execute(ThreadContextExecutor.java:263)","
    at com.sap.cloud.sdk.cloudplatform.servletjakarta.RequestAccessorFilter.doFilter(RequestAccessorFilter.java:60)","\t... 84 more","Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoSuchMethodError: 'java.lang.Object com.sap.cloud.sdk.cloudplatform.util.FacadeLocator.getFacade(java.lang.Class)' [in thread \"http-nio-8080-exec-9\"]","
    at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextAccessor.<clinit>(RequestContextAccessor.java:30)","\t... 98 more"]}

Application Logs

logs.txt

<!-- Maven Dependency Tree
com.sap.cloud.s4hana:migratehistoricaldata-application:jar:1.0-SNAPSHOT
[INFO] +- com.sap.cloud.sdk.cloudplatform:tenant:jar:5.3.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core:jar:5.3.0:compile
[INFO] |  |  \- com.google.guava:guava:jar:33.0.0-jre:compile
[INFO] |  |     +- com.google.guava:failureaccess:jar:1.0.2:compile
[INFO] |  |     +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |     +- org.checkerframework:checker-qual:jar:3.42.0:compile
[INFO] |  |     +- com.google.errorprone:error_prone_annotations:jar:2.24.1:compile
[INFO] |  |     \- com.google.j2objc:j2objc-annotations:jar:2.8:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:security:jar:5.3.0:compile
[INFO] |  |  \- org.apache.commons:commons-lang3:jar:3.14.0:compile
[INFO] |  +- io.vavr:vavr:jar:0.10.4:compile
[INFO] |  |  \- io.vavr:vavr-match:jar:0.10.4:compile
[INFO] |  +- com.auth0:java-jwt:jar:4.4.0:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.16.1:compile
[INFO] |  |     \- com.fasterxml.jackson.core:jackson-core:jar:2.16.1:compile
[INFO] |  +- com.sap.cloud.environment.servicebinding.api:java-core-api:jar:0.10.2:compile
[INFO] |  \- com.sap.cloud.environment.servicebinding.api:java-access-api:jar:0.10.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:3.2.0:test
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:3.2.0:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:3.2.0:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.21.1:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.21.1:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:2.0.9:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:2.2:compile
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.8.0:test
[INFO] |  +- net.minidev:json-smart:jar:2.5.0:test
[INFO] |  |  \- net.minidev:accessors-smart:jar:2.5.0:test
[INFO] |  |     \- org.ow2.asm:asm:jar:9.3:test
[INFO] |  +- org.assertj:assertj-core:jar:3.24.2:test
[INFO] |  |  \- net.bytebuddy:byte-buddy:jar:1.14.10:runtime
[INFO] |  +- org.awaitility:awaitility:jar:4.2.0:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.10.1:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-params:jar:5.10.1:test
[INFO] |  +- org.mockito:mockito-core:jar:5.7.0:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.14.10:test
[INFO] |  |  \- org.objenesis:objenesis:jar:3.3:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:5.7.0:test
[INFO] |  +- org.springframework:spring-core:jar:6.1.1:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:6.1.1:compile
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.9.1:test
[INFO] +- org.junit.vintage:junit-vintage-engine:jar:5.10.1:test
[INFO] |  +- org.junit.platform:junit-platform-engine:jar:1.10.1:test
[INFO] |  +- junit:junit:jar:4.13.2:test
[INFO] |  |  \- org.hamcrest:hamcrest-core:jar:2.2:test
[INFO] |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.10.1:test
[INFO] +- com.sap.cloud.sdk:sdk-core:jar:5.3.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity:jar:5.3.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:resilience-api:jar:5.3.0:compile
[INFO] |  |  +- org.slf4j:jcl-over-slf4j:jar:2.0.9:runtime
[INFO] |  |  +- com.mikesamuel:json-sanitizer:jar:1.2.3:compile
[INFO] |  |  +- org.bouncycastle:bcprov-jdk18on:jar:1.77:compile
[INFO] |  |  \- org.bouncycastle:bcpkix-jdk18on:jar:1.77:compile
[INFO] |  |     \- org.bouncycastle:bcutil-jdk18on:jar:1.77:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:connectivity-destination-service:jar:5.3.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:connectivity-apache-httpclient4:jar:5.3.0:compile
[INFO] |  |  +- com.google.code.gson:gson:jar:2.10.1:compile
[INFO] |  |  +- com.github.ben-manes.caffeine:caffeine:jar:3.1.8:compile
[INFO] |  |  +- commons-io:commons-io:jar:2.15.1:compile
[INFO] |  |  \- com.sap.cloud.environment.servicebinding.api:java-consumption-api:jar:0.10.2:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:connectivity-oauth:jar:5.3.0:compile
[INFO] |  |  \- com.sap.cloud.security.xsuaa:token-client:jar:3.3.4:compile
[INFO] |  |     \- org.json:json:jar:20231013:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:servlet-jakarta:jar:5.3.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:resilience:jar:5.3.0:compile
[INFO] |  |  \- com.sap.cloud.sdk.cloudplatform:resilience4j:jar:5.3.0:compile
[INFO] |  |     +- io.github.resilience4j:resilience4j-circuitbreaker:jar:2.2.0:compile
[INFO] |  |     |  \- io.github.resilience4j:resilience4j-core:jar:2.2.0:compile
[INFO] |  |     +- io.github.resilience4j:resilience4j-bulkhead:jar:2.2.0:compile
[INFO] |  |     +- io.github.resilience4j:resilience4j-timelimiter:jar:2.2.0:compile
[INFO] |  |     +- io.github.resilience4j:resilience4j-retry:jar:2.2.0:compile
[INFO] |  |     +- io.github.resilience4j:resilience4j-ratelimiter:jar:2.2.0:compile
[INFO] |  |     \- javax.cache:cache-api:jar:1.1.1:compile
[INFO] |  \- com.sap.cloud.sdk.cloudplatform:caching:jar:5.3.0:compile
[INFO] +- org.slf4j:slf4j-api:jar:2.0.11:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.4.11:compile
[INFO] |  \- ch.qos.logback:logback-core:jar:1.4.11:compile
[INFO] +- com.sap.hcp.cf.logging:cf-java-logging-support-logback:jar:3.7.1:compile
[INFO] |  \- com.sap.hcp.cf.logging:cf-java-logging-support-core:jar:3.7.1:compile
[INFO] |     \- com.fasterxml.jackson.jr:jackson-jr-objects:jar:2.15.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:3.2.0:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:3.2.0:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.15.3:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.16.1:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.15.3:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:3.2.0:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:10.1.16:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:10.1.16:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:10.1.16:compile
[INFO] |  +- org.springframework:spring-web:jar:6.1.1:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:6.1.1:compile
[INFO] |  |  \- io.micrometer:micrometer-observation:jar:1.12.0:compile
[INFO] |  |     \- io.micrometer:micrometer-commons:jar:1.12.0:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:6.1.1:compile
[INFO] |     +- org.springframework:spring-context:jar:6.1.1:compile
[INFO] |     \- org.springframework:spring-expression:jar:6.1.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:3.2.0:compile
[INFO] |  +- org.springframework:spring-aop:jar:6.1.1:compile
[INFO] |  +- org.springframework.security:spring-security-config:jar:6.2.0:compile
[INFO] |  |  \- org.springframework.security:spring-security-core:jar:6.2.0:compile
[INFO] |  |     \- org.springframework.security:spring-security-crypto:jar:6.2.0:compile
[INFO] |  \- org.springframework.security:spring-security-web:jar:6.2.0:compile
[INFO] +- com.sap.cloud.security:resourceserver-security-spring-boot-starter:jar:3.3.4:compile
[INFO] |  +- com.sap.cloud.security:spring-security:jar:3.3.4:compile
[INFO] |  +- org.springframework.security:spring-security-oauth2-jose:jar:6.2.0:compile
[INFO] |  |  +- org.springframework.security:spring-security-oauth2-core:jar:6.2.0:compile
[INFO] |  |  \- com.nimbusds:nimbus-jose-jwt:jar:9.24.4:compile
[INFO] |  |     \- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] |  +- org.springframework.security:spring-security-oauth2-resource-server:jar:6.2.0:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:3.2.0:compile
[INFO] |  \- com.sap.cloud.security:java-api:jar:3.3.4:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.30:provided
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.10.0:test
[INFO] |  +- org.opentest4j:opentest4j:jar:1.3.0:test
[INFO] |  \- org.junit.platform:junit-platform-commons:jar:1.10.0:test
[INFO] +- org.springframework:spring-test:jar:6.1.1:test
[INFO] +- org.springframework.boot:spring-boot-test:jar:3.2.0:test
[INFO] |  \- org.springframework.boot:spring-boot:jar:3.2.0:compile
[INFO] +- org.springframework.boot:spring-boot-test-autoconfigure:jar:3.2.0:test
[INFO] +- org.skyscreamer:jsonassert:jar:1.5.1:test
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:3.2.0:compile
[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:3.5.4:compile
[INFO] |  +- org.apache.cxf:cxf-core:jar:3.5.4:compile
[INFO] |  |  +- org.glassfish.jaxb:jaxb-runtime:jar:4.0.4:compile
[INFO] |  |  |  \- org.glassfish.jaxb:jaxb-core:jar:4.0.4:compile
[INFO] |  |  |     +- org.glassfish.jaxb:txw2:jar:4.0.4:compile
[INFO] |  |  |     \- com.sun.istack:istack-commons-runtime:jar:4.1.2:compile
[INFO] |  |  +- com.fasterxml.woodstox:woodstox-core:jar:6.2.8:compile
[INFO] |  |  |  \- org.codehaus.woodstox:stax2-api:jar:4.2.1:compile
[INFO] |  |  \- org.apache.ws.xmlschema:xmlschema-core:jar:2.3.0:compile
[INFO] |  +- jakarta.ws.rs:jakarta.ws.rs-api:jar:3.1.0:compile
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
[INFO] |  +- org.apache.cxf:cxf-rt-transports-http:jar:3.5.4:compile
[INFO] |  +- org.apache.cxf:cxf-rt-security:jar:3.5.4:compile
[INFO] |  +- jakarta.xml.ws:jakarta.xml.ws-api:jar:4.0.1:compile
[INFO] |  +- jakarta.jws:jakarta.jws-api:jar:2.1.0:compile
[INFO] |  +- jakarta.xml.soap:jakarta.xml.soap-api:jar:3.0.1:compile
[INFO] |  +- com.sun.activation:jakarta.activation:jar:1.2.2:compile
[INFO] |  +- com.sun.xml.messaging.saaj:saaj-impl:jar:3.0.3:runtime
[INFO] |  |  +- org.jvnet.staxex:stax-ex:jar:2.1.0:runtime
[INFO] |  |  \- org.eclipse.angus:angus-activation:jar:2.0.1:runtime
[INFO] |  \- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] +- jakarta.enterprise:jakarta.enterprise.cdi-api:jar:3.0.0:compile
[INFO] |  +- jakarta.el:jakarta.el-api:jar:4.0.0:compile
[INFO] |  \- jakarta.interceptor:jakarta.interceptor-api:jar:2.0.0:compile
[INFO] +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.1:compile
[INFO] |  \- jakarta.activation:jakarta.activation-api:jar:2.1.2:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:4.0.4:runtime
[INFO] |  \- com.sun.xml.bind:jaxb-core:jar:4.0.4:compile
[INFO] +- jakarta.inject:jakarta.inject-api:jar:1.0.3:compile
[INFO] +- jakarta.validation:jakarta.validation-api:jar:3.0.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:3.2.0:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:3.2.0:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.9.20.1:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:3.2.0:compile
[INFO] |  |  +- com.zaxxer:HikariCP:jar:5.0.1:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:6.1.1:compile
[INFO] |  +- org.hibernate.orm:hibernate-core:jar:6.3.1.Final:compile
[INFO] |  |  +- jakarta.transaction:jakarta.transaction-api:jar:2.0.1:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.5.3.Final:runtime
[INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:6.0.6.Final:runtime
[INFO] |  |  +- io.smallrye:jandex:jar:3.1.2:runtime
[INFO] |  |  +- com.fasterxml:classmate:jar:1.6.0:runtime
[INFO] |  |  \- org.antlr:antlr4-runtime:jar:4.10.1:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:3.2.0:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:3.2.0:compile
[INFO] |  |  +- org.springframework:spring-orm:jar:6.1.1:compile
[INFO] |  |  \- org.springframework:spring-tx:jar:6.1.1:compile
[INFO] |  \- org.springframework:spring-aspects:jar:6.1.1:compile
[INFO] +- com.h2database:h2:jar:2.2.224:runtime
[INFO] +- javax:javaee-web-api:jar:8.0.1:provided
[INFO] +- com.sap.cloud.s4hana.cloudplatform:scp-cf:jar:2.9.1:provided
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:auditlog-scp-cf:jar:2.9.1:provided
[INFO] |  |  +- com.sap.cloud.s4hana.cloudplatform:core:jar:2.9.1:provided
[INFO] |  |  +- com.sap.cloud.s4hana.cloudplatform:auditlog:jar:2.9.1:provided
[INFO] |  |  \- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:caching:jar:2.9.1:provided
[INFO] |  |  +- com.sap.cloud.s4hana.cloudplatform:security:jar:2.9.1:provided
[INFO] |  |  \- com.sap.cloud.s4hana.cloudplatform:tenant:jar:2.9.1:provided
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:core-scp-cf:jar:2.9.1:provided
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:connectivity-scp-cf:jar:2.9.1:provided
[INFO] |  |  +- com.sap.cloud.s4hana.cloudplatform:connectivity:jar:2.9.1:provided
[INFO] |  |  |  \- com.sap.cloud.s4hana.quality:common:jar:2.9.1:provided
[INFO] |  |  +- com.sap.cloud.s4hana.frameworks:hystrix:jar:2.9.1:provided
[INFO] |  |  |  +- commons-configuration:commons-configuration:jar:1.10:provided
[INFO] |  |  |  |  \- commons-lang:commons-lang:jar:2.6:provided
[INFO] |  |  |  \- com.netflix.archaius:archaius-core:jar:0.7.6:provided
[INFO] |  |  \- com.netflix.hystrix:hystrix-core:jar:1.5.18:provided
[INFO] |  |     +- io.reactivex:rxjava:jar:1.2.0:provided
[INFO] |  |     \- org.hdrhistogram:HdrHistogram:jar:2.1.9:provided
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:security-scp-cf:jar:2.9.1:provided
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:servlet:jar:2.9.1:provided
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.16.1:compile
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:tenant-scp-cf:jar:2.9.1:provided
[INFO] |  \- com.sap.cloud.s4hana.cloudplatform:metering:jar:2.9.1:provided
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.14:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.16:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.2:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.16.0:compile
[INFO] +- org.eclipse.persistence:eclipselink:jar:4.0.2:compile
[INFO] |  +- jakarta.persistence:jakarta.persistence-api:jar:3.1.0:compile
[INFO] |  \- com.sun.xml.bind:jaxb-xjc:jar:4.0.4:compile
[INFO] +- org.apache.olingo:olingo-odata2-jpa-processor-core:jar:2.0.9:compile
[INFO] |  +- org.apache.olingo:olingo-odata2-api-annotation:jar:2.0.9:compile
[INFO] |  +- org.eclipse.persistence:javax.persistence:jar:2.0.5:compile
[INFO] |  +- org.apache.olingo:olingo-odata2-api:jar:2.0.9:compile
[INFO] |  +- org.apache.olingo:olingo-odata2-core:jar:2.0.9:compile
[INFO] |  |  \- javax.ws.rs:javax.ws.rs-api:jar:2.0-m10:compile
[INFO] |  \- org.apache.olingo:olingo-odata2-jpa-processor-api:jar:2.0.9:compile
[INFO] +- org.apache.deltaspike.modules:deltaspike-data-module-api:jar:1.9.6:compile
[INFO] |  +- org.apache.deltaspike.core:deltaspike-core-api:jar:1.9.6:compile
[INFO] |  +- org.apache.deltaspike.modules:deltaspike-partial-bean-module-api:jar:1.9.6:compile
[INFO] |  \- org.apache.deltaspike.modules:deltaspike-jpa-module-api:jar:1.9.6:compile
[INFO] +- org.apache.deltaspike.modules:deltaspike-data-module-impl:jar:1.9.6:runtime
[INFO] |  +- org.apache.deltaspike.core:deltaspike-core-impl:jar:1.9.6:runtime
[INFO] |  +- org.apache.deltaspike.modules:deltaspike-partial-bean-module-impl:jar:1.9.6:runtime
[INFO] |  |  +- org.apache.deltaspike.modules:deltaspike-proxy-module-api:jar:1.9.6:runtime
[INFO] |  |  \- org.apache.deltaspike.modules:deltaspike-proxy-module-impl-asm:jar:1.9.6:runtime
[INFO] |  \- org.apache.deltaspike.modules:deltaspike-jpa-module-impl:jar:1.9.6:runtime
[INFO] +- com.github.VEINHORN:xelem-wrapper:jar:c3e6af2c1f:compile
[INFO] +- com.sap.cloud.security:java-security-test:jar:3.3.4:test
[INFO] |  +- com.sap.cloud.security:java-security:jar:3.3.4:compile
[INFO] |  |  \- com.sap.cloud.security:env:jar:3.3.4:compile
[INFO] |  |     +- com.sap.cloud.environment.servicebinding:java-sap-vcap-services:jar:0.10.2:compile
[INFO] |  |     \- com.sap.cloud.environment.servicebinding:java-sap-service-operator:jar:0.10.2:compile
[INFO] |  +- org.eclipse.jetty:jetty-server:jar:12.0.3:test
[INFO] |  |  +- org.eclipse.jetty:jetty-http:jar:12.0.3:test
[INFO] |  |  |  \- org.eclipse.jetty:jetty-util:jar:12.0.3:test
[INFO] |  |  \- org.eclipse.jetty:jetty-io:jar:12.0.3:test
[INFO] |  +- org.eclipse.jetty.ee10:jetty-ee10-servlet:jar:12.0.3:test
[INFO] |  |  +- jakarta.servlet:jakarta.servlet-api:jar:6.0.0:test
[INFO] |  |  +- org.eclipse.jetty:jetty-security:jar:12.0.3:test
[INFO] |  |  \- org.eclipse.jetty:jetty-session:jar:12.0.3:test
[INFO] |  +- org.eclipse.jetty.ee10:jetty-ee10-webapp:jar:12.0.3:test
[INFO] |  |  \- org.eclipse.jetty:jetty-xml:jar:12.0.3:test
[INFO] |  \- org.wiremock:wiremock-standalone:jar:3.3.1:test
[INFO] +- org.apache.httpcomponents.client5:httpclient5:jar:5.3.1:compile
[INFO] |  +- org.apache.httpcomponents.core5:httpcore5:jar:5.2.4:compile
[INFO] |  \- org.apache.httpcomponents.core5:httpcore5-h2:jar:5.2.3:compile
[INFO] \- com.sap.cloud.security.samples:spring-security-xsuaa-usage:jar:3.3.4:compile
[INFO]    \- com.sap.cloud.security.xsuaa:xsuaa-spring-boot-starter:jar:3.3.4:compile
[INFO]       \- com.sap.cloud.security.xsuaa:spring-xsuaa:jar:3.3.4:compile
-->

Project Details

(https://github.com/abhishekp1254/migration/tree/main)


Checklist

Johannes-Schneider commented 9 months ago

Hi @abhishekp1254,

I found following section in your maven dependency tree:

[INFO] +- com.sap.cloud.s4hana.cloudplatform:scp-cf:jar:2.9.1:provided
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:auditlog-scp-cf:jar:2.9.1:provided
[INFO] |  |  +- com.sap.cloud.s4hana.cloudplatform:core:jar:2.9.1:provided
[INFO] |  |  +- com.sap.cloud.s4hana.cloudplatform:auditlog:jar:2.9.1:provided
[INFO] |  |  \- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:caching:jar:2.9.1:provided
[INFO] |  |  +- com.sap.cloud.s4hana.cloudplatform:security:jar:2.9.1:provided
[INFO] |  |  \- com.sap.cloud.s4hana.cloudplatform:tenant:jar:2.9.1:provided
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:core-scp-cf:jar:2.9.1:provided
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:connectivity-scp-cf:jar:2.9.1:provided
[INFO] |  |  +- com.sap.cloud.s4hana.cloudplatform:connectivity:jar:2.9.1:provided
[INFO] |  |  |  \- com.sap.cloud.s4hana.quality:common:jar:2.9.1:provided
[INFO] |  |  +- com.sap.cloud.s4hana.frameworks:hystrix:jar:2.9.1:provided
[INFO] |  |  |  +- commons-configuration:commons-configuration:jar:1.10:provided
[INFO] |  |  |  |  \- commons-lang:commons-lang:jar:2.6:provided
[INFO] |  |  |  \- com.netflix.archaius:archaius-core:jar:0.7.6:provided
[INFO] |  |  \- com.netflix.hystrix:hystrix-core:jar:1.5.18:provided
[INFO] |  |     +- io.reactivex:rxjava:jar:1.2.0:provided
[INFO] |  |     \- org.hdrhistogram:HdrHistogram:jar:2.1.9:provided
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:security-scp-cf:jar:2.9.1:provided
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:servlet:jar:2.9.1:provided
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.16.1:compile
[INFO] |  +- com.sap.cloud.s4hana.cloudplatform:tenant-scp-cf:jar:2.9.1:provided
[INFO] |  \- com.sap.cloud.s4hana.cloudplatform:metering:jar:2.9.1:provided

This looks VERY wrong: These modules (with group id com.sap.cloud.s4hana) are from the Cloud SDK major version 2 and (most certainly) produce class name clashes. These are declared explicitly in your pom.xml but shouldn't be used anywhere in your project. So I suggest to get rid of these dependencies entirely.

Best regards, Johannes

abhishekp1254 commented 9 months ago

Thank you @Johannes-Schneider , it is working fine after those dependencies are removed. Thank you again. Closing this issue.