0

During (local) startup of the example application cloud-s4-sdk-book in the branch 15_2_spring_boot the following exception is thrown:

16:01:38.786 [localhost-startStop-1] DEBUG com.sap.cloud.sdk.cloudplatform.servlet.RequestContextServletFilter - Filter initialization parameter factory not defined.
16:01:38.787 [localhost-startStop-1] INFO com.sap.cloud.sdk.cloudplatform.servlet.RequestContextServletFilter - No RequestContextFactory configured. Falling back to DefaultRequestContextFactory.
16:01:38.798 [localhost-startStop-1] INFO com.sap.cloud.sdk.cloudplatform.servlet.RequestContextListenerChain - Added default listener com.sap.cloud.sdk.cloudplatform.security.user.UserRequestContextListener with priority -4.
16:01:38.798 [localhost-startStop-1] INFO com.sap.cloud.sdk.cloudplatform.servlet.RequestContextListenerChain - Added default listener com.sap.cloud.sdk.cloudplatform.tenant.TenantRequestContextListener with priority -3.
16:01:38.799 [localhost-startStop-1] INFO com.sap.cloud.sdk.cloudplatform.servlet.RequestContextListenerChain - Added default listener com.sap.cloud.sdk.cloudplatform.connectivity.DestinationsRequestContextListener with priority -2.
16:01:38.799 [localhost-startStop-1] INFO com.sap.cloud.sdk.cloudplatform.servlet.RequestContextListenerChain - Added default listener com.sap.cloud.sdk.cloudplatform.security.AuthTokenRequestContextListener with priority -5.
16:01:43.862 [main] WARN com.sap.cloud.s4hana.examples.addressmgr.config.TenantIdentifierResolver - Tenant not found
com.sap.cloud.sdk.cloudplatform.tenant.exception.TenantAccessException: Failed to get current tenant: no RequestContext available. Have you correctly configured a RequestContextServletFilter or have you wrapped your logic in a RequestContextExecutor when executing background tasks that are not triggered by a request?

The exception is thrown inside method "loadFactory" of class RequestContextServletFilter.

I am starting the application using mvn spring-boot:run.

What can I do the get the application started correctly?

O. Merk
  • 113
  • 10

1 Answers1

0

This exception is expected and can usually be ignored if you are running this application locally, where no tenant is available. The application should still work, because there is a fallback in place to a tenant identifier default-tenant .

Keep in mind that you need to subscribe the default tenant before interacting with the database - do an HTTP request PUT /api/callback/tenant/default-tenant.

Please note that this exception is only being logged as a warning. If you want to clean the log, adapt the TenantIdentifierResolver class.

  • When trying to PUT the default-tenant, a JWT-token is expected: com.sap.cloud.sdk.cloudplatform.security.exception.AuthTokenAccessException: Failed to decode JWT bearer: no JWT bearer present in "Authorization" header of request. How can this be solved when running locally? – O. Merk Jan 04 '19 at 09:42
  • I could solve the JWT-token handling following the instructions from openSAP course Cloud-Native Development with SAP Cloud Platform,Unit 4: Making Your Application Secure – Part I – O. Merk Jan 04 '19 at 13:54