4

S/4HANA SDK を使用して CompanyCode OData VDM サービスを呼び出そうとしていますが、Cloud Foundry 環境でこれを行うと、添付のエラーが発生します。以前に SDK を使用していましたが、これは起こりませんでした。ここで私を助けてもらえますか?

コード:

public List<CompanyCode> findAll() {
    try {
        return compCodeService.getAllCompanyCode().execute(erp())
                .stream()
                .map(this::toCompCode)
                .collect(Collectors.toList());
    } catch (ODataException e) {
        throw SapException.create(e.getMessage());
    }
}

private ErpConfigContext erp(){
    return new ErpConfigContext(REPLICATE_WORKFORCE);
}

 public static final String REPLICATE_WORKFORCE = "REPLICATE_WORKFORCE";

エラー:

 [Request processing failed; nested exception is 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?] with root cause
    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?
   at com.sap.cloud.sdk.cloudplatform.tenant.AbstractTenantFacade.getCurrentTenantIfAvailable(AbstractTenantFacade.java:85) ~[tenant-2.5.0.jar!/:na]

   at com.sap.cloud.sdk.cloudplatform.tenant.TenantAccessor.getCurrentTenantIfAvailable(TenantAccessor.java:109) ~[tenant-2.5.0.jar!/:na]
   at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationFacade.getCacheKey(ScpCfDestinationFacade.java:132) ~[connectivity-scp-cf-2.5.0.jar!/:na]
   at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestinationFacade.getGenericDestinationsByName(ScpCfDestinationFacade.java:178) ~[connectivity-scp-cf-2.5.0.jar!/:na]
   at com.sap.cloud.sdk.cloudplatform.connectivity.AbstractDestinationFacade.getGenericDestination(AbstractDestinationFacade.java:173) ~[com.sap.cloud.s4hana.cloudplatform-connectivity-2.5.0.jar!/:na]
   at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationAccessor.getGenericDestination(DestinationAccessor.java:176) ~[com.sap.cloud.s4hana.cloudplatform-connectivity-2.5.0.jar!/:na]
   at com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext.(ErpConfigContext.java:218) ~[com.sap.cloud.s4hana-connectivity-2.5.0.jar!/:na]
   at com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext.(ErpConfigContext.java:367) ~[com.sap.cloud.s4hana-connectivity-2.5.0.jar!/:na]
   at com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext.(ErpConfigContext.java:442) ~[com.sap.cloud.s4hana-connectivity-2.5.0.jar!/:na]
   at com.sap.csc.employeecreationbe.repository.SdkCompanyCodeRepository.erp(SdkCompanyCodeRepository.java:74) ~[classes/:na]
   at com.sap.csc.employeecreationbe.repository.SdkCompanyCodeRepository.findAll(SdkCompanyCodeRepository.java:64) ~[classes/:na]
   at com.sap.csc.employeecreationbe.repository.SdkCompanyCodeRepository$$FastClassBySpringCGLIB$$f89ad4b4.invoke() ~[classes/:na]
   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746) ~[spring-aop-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) ~[spring-tx-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) ~[spring-aop-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) ~[spring-aop-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at com.sap.csc.employeecreationbe.repository.SdkCompanyCodeRepository$$EnhancerBySpringCGLIB$$4dd15cde.findAll() ~[classes/:na]
   at com.sap.csc.employeecreationbe.controller.EmployeeController.companyCodes(EmployeeController.java:216) ~[classes/:na]
   at com.sap.csc.employeecreationbe.controller.EmployeeController$$FastClassBySpringCGLIB$$543220b2.invoke() ~[classes/:na]
   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746) ~[spring-aop-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) ~[spring-aop-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
   at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) ~[spring-aop-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] and so on
4

1 に答える 1