Skip to content

Error 404 - calling wrong service #1089

@antoineRoy06

Description

@antoineRoy06

Describe the Bug

I generated an OData V4 client for a CAP service. When I call the service like this

private void prepareService() {
        DefaultV1CrossLibraryDevelopmentService serviceWithDefaultPath = new DefaultV1CrossLibraryDevelopmentService();
        this.service = serviceWithDefaultPath.withServicePath("odata/v4/api/v1");
    }

it fails with the error 404 and the logs are displaying that the wrong service was loaded :

Available services: [OutboxService$InMemory, ApplicationLifecycleService$Default, TaskManagementService, TagService, ProjectService, api.v1.CrossLibraryDevelopmentAPI, AuthorizationService$Default, DocumentService, lib.CrossDomainService, ChangeTrackingService$Default, AuditLogService$Default, ProcessServiceV2, DeploymentService$Default, PersistenceService$Default, PmProcessHierarchyService, TenantProviderService$Default, LibraryService, PmStandardContentService, api.v1.CrossLibraryApplicationAPI]
2026-02-06 11:26:07,819 INFO  [http-nio-auto-1-exec-1] - [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]] [] - Initializing Spring DispatcherServlet 'dispatcherServlet'
2026-02-06 11:26:07,819 INFO  [http-nio-auto-1-exec-1] - [org.springframework.web.servlet.DispatcherServlet] [] - Initializing Servlet 'dispatcherServlet'
2026-02-06 11:26:07,820 INFO  [http-nio-auto-1-exec-1] - [org.springframework.web.servlet.DispatcherServlet] [] - Completed initialization in 1 ms
2026-02-06 11:26:07,972 INFO  [http-nio-auto-1-exec-1] - [com.sap.cds.adapter.odata.v4.metadata.MetadataInfo] [tenant_id=9442b3ac-4a9c-4c60-a974-fa9defd284ae, correlation_id=ce0e8aab-70d6-42a5-8f14-65394667f815] - Loading OData V4 metadata for service 'api.v1.CrossLibraryApplicationAPI'

It is loading the service "CrossLibraryApplicationAPI" instead of "CrossLibraryDevelopmentAPI", they have very similar name but are not the same. We can also see in the logs that "CrossLibraryDevelopmentAPI" is available.

This is happening randomly. Sometime the test is calling the correct service sometime it is not.

Steps to Reproduce

Clone repository https://github.tools.sap/CALMBuild/ptm-lib-srv.git.
Checkout branch feature-CRUDAPII4Developments.
Use attached maven settings.
npm ci.
npm run build-notests.
Run cucumber test scenario I can use the API to delete an existing Development
settings.xml

Expected Behavior

I should have a green test with result 204.

Screenshots

No response

Used Versions

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: C:\Users\I313565\apache-maven-3.9.6
Java version: 21.0.9, vendor: SAP SE, runtime: C:\Program Files\SapMachine\JDK\21
Default locale: en_US, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

  • SAP Cloud SDK version: ...
  • Spring Boot or CAP version: ...

Code Examples

protected static DefaultV1CrossLibraryDevelopmentService service;
 try {
            developmentsModificationResponse =
                    service.deleteDevelopments(development).withoutCsrfToken().execute(getDest());
            httpStatusCode = developmentsModificationResponse.getResponseStatusCode();
        } catch (ODataServiceErrorException exception) {
            // Copy exception.
            oDataServiceErrorException = exception;
        }

Stack Trace

No response

Log File

Log file ...

Affected Development Phase

Getting Started

Impact

No Impact

Timeline

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions