0

在分支 15_2_spring_boot 中示例应用程序 cloud-s4-sdk-book 的(本地)启动期间,将引发以下异常:

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?

异常在类 RequestContextServletFilter 的方法“loadFactory”中引发。

我正在使用 mvn spring-boot:run 启动应用程序。

我该怎么做才能正确启动应用程序?

4

1 回答 1

0

如果您在本地运行此应用程序(没有可用的租户),则此异常是预期的,通常可以忽略。该应用程序应该仍然可以工作,因为有一个对租户标识符的回退default-tenant

请记住,在与数据库交互之前,您需要订阅默认租户 - 执行 HTTP 请求PUT /api/callback/tenant/default-tenant

请注意,此异常仅作为警告记录。如果要清理日志,请调整 TenantIdentifierResolver 类。

于 2019-01-02T12:24:17.400 回答