SecurityContext.getUserInfo () не работает с локального хоста - PullRequest
0 голосов
/ 11 июля 2019

Я получаю ID пользователя, используя приведенный ниже фрагмент кода. Требуется для ведения журнала аудита

final UserInfo userInfo = SecurityContext.getUserInfo (); final String userId = userInfo.getLogonName ();

После развертывания приложения в Cloud Foundry оно работает как положено.

Проблема в том, что вы запускаете приложение в localhost. Вышеупомянутый метод не работает и приводит к исключению.

Чтобы справиться с этим, я также выполнил насмешку, используя приведенный ниже фрагмент кода,

@Profile("local")
@Configuration
public class LocalSecurityConfig {
    private static final Logger LOGGER = CloudLoggerFactory.getSanitizedLogger(LocalSecurityConfig.class);
    public static final String XSAPPNAME = "test-xsappname!t0";

    public LocalSecurityConfig() throws IOException {
        final MockUtil mockUtil = new MockUtil();
        mockUtil.mockDefaults();
        mockUtil.mockAuditLog();

        final String publicKey = FileUtils.readFile("publicKey.txt");
        final Map<String, String> verificationkey = ImmutableMap.of("verificationkey", publicKey);
        final JsonObject xsuaaServiceCredentials = new Gson().toJsonTree(verificationkey).getAsJsonObject();
        when(((ScpCfCloudPlatform) CloudPlatformAccessor.getCloudPlatform())
                .getXsuaaServiceCredentials(org.mockito.ArgumentMatchers.any(DecodedJWT.class)))
                        .thenReturn(xsuaaServiceCredentials);
    }
    ---
}

Вышеупомянутый код хорошо работает для локального тестирования интеграции.

Исключение происходит в приведенном ниже коде final userInfo.getLogonName () метода getUserId ()

@AfterQuery(entity = VIEW_CLOUDSERVICES, serviceName = LANDSCAPE_SERVICE)
public QueryResponse afterQueryTechnicalServices(QueryRequest req, QueryResponseAccessor res, ExtensionHelper h) {
    List<EntityData> entData = res.getEntityDataList();
    LOG.info("##### CloudServices.afterQuery: {} ########", entData.size());

    QueryResponse response = null;
    String userId = null;
    String identityZone = null;
    try {
        userId = getUserId();
        identityZone = SecurityContext.getUserInfo().getIdentityZone();
    } catch (UserInfoException e1) {
        response = QueryResponse.setError(ErrorResponse.getBuilder().setStatusCode(HttpStatus.UNAUTHORIZED.value())
                .setCause(e1).setMessage("USERCONTEXT_UNAUTHORIZED", e1.toString()).response());
        LOG.error("Failed to Read User Information: Exception Text={}", e1.getMessage(), e1);

        AuditLogger.logDataRead(new AccessRequester(userId, identityZone, null, null),
                new AuditedDataObject(ENTITY_ENDPOINT, (String) "LMS"),
                new AuditedDataSubject("person", "user", userId), null,
                new AccessedAttribute(VIEW_CLOUDSERVICES, Operation.READ, "Read Cloud Services", null, entData, true));

        return response;
    }
    AuditLogger.logDataRead(new AccessRequester(userId, identityZone, null, null),
            new AuditedDataObject(ENTITY_ENDPOINT, (String) "LMS"),
            new AuditedDataSubject("person", "user", userId), null,
            new AccessedAttribute(VIEW_CLOUDSERVICES, Operation.READ, "Read Cloud Services", null, entData, true));

    return QueryResponse.setSuccess().setData(entData).response();
}

private String getUserId() throws UserInfoException {

    final UserInfo userInfo = SecurityContext.getUserInfo();
    System.out.println(userInfo);
    final String userId = userInfo.getLogonName();
    System.out.println(userId);

    MDC.put("user_name", userId);
    LOG.debug("UserConfig - ClientId: {}", userInfo.getClientId());

    if (userId == null || userId.length() == 0) {
        throw new IllegalStateException("logon_name attribute was not returned from UserInfo!");
    }

    System.out.println("Benu" + "returned");
    return userId;
}

Error

019-07-12 10:49:15.388 ERROR 21492 --- [nio-8085-exec-2] com.sap.crun.landscape.LandscapeService  : Failed to Read User Information: Exception Text=Invalid user attribute grant_type (END OF LOG ENTRY)
2019-07-12 10:49:15.429 DEBUG 21492 --- [nio-8085-exec-2] c.s.c.s.s.p.v.rt.cds.CDSDataSourceParam  : -------------------------INITIALIZED CONNECTION OBTAINED------------------
2019-07-12 10:49:15.449 DEBUG 21492 --- [nio-8085-exec-2] c.s.c.s.s.p.v.rt.cds.CDSDataSourceParam  : -------------------------INITIALIZED CONNECTION OBTAINED------------------
2019-07-12 10:49:15.449 DEBUG 21492 --- [nio-8085-exec-2] c.s.c.s.s.p.r.c.w.CDSConnectionWrapper   : ----------------CONNECTION CLOSED-------------------------
2019-07-12 10:49:15.456 ERROR 21492 --- [nio-8085-exec-2] c.s.c.s.s.p.v.r.d.provider.DataProvider  : Error in readEntitySet

org.apache.olingo.odata2.api.exception.ODataApplicationException: Unable to execute the operation. Please check the logs for more details.
    at com.sap.cloud.sdk.service.prov.v2.rt.core.extensions.ExtensionDataProvider.handleException(ExtensionDataProvider.java:2497) ~[odata2.core-1.29.0.jar:na]
    at com.sap.cloud.sdk.service.prov.v2.rt.core.extensions.ExtensionDataProvider.checkAndExecuteAfterExit(ExtensionDataProvider.java:1068) ~[odata2.core-1.29.0.jar:na]
    at com.sap.cloud.sdk.service.prov.v2.rt.core.extensions.ExtensionDataProvider.readEntitySetNonDraftFlow(ExtensionDataProvider.java:565) ~[odata2.core-1.29.0.jar:na]
    at com.sap.cloud.sdk.service.prov.v2.rt.core.extensions.ExtensionDataProvider.readEntitySet(ExtensionDataProvider.java:391) ~[odata2.core-1.29.0.jar:na]
    at com.sap.cloud.sdk.service.prov.v2.rt.data.provider.HybridDataProvider.readEntitySet(HybridDataProvider.java:126) ~[odatav2-hybrid-1.29.0.jar:na]
    at com.sap.gateway.core.api.provider.data.GenericODataProcessor.readEntitySet(GenericODataProcessor.java:885) [odata-core-1.29.0.jar:na]
    at org.apache.olingo.odata2.core.Dispatcher.dispatch(Dispatcher.java:77) [odatav2-lib-1.29.0.jar:na]
    at org.apache.olingo.odata2.core.ODataRequestHandler.handle(ODataRequestHandler.java:131) [odatav2-lib-1.29.0.jar:na]
    at org.apache.olingo.odata2.core.servlet.ODataServlet.handleRequest(ODataServlet.java:216) [odatav2-lib-1.29.0.jar:na]
    at org.apache.olingo.odata2.core.servlet.ODataServlet.handle(ODataServlet.java:115) [odatav2-lib-1.29.0.jar:na]
    at org.apache.olingo.odata2.core.servlet.ODataServlet.service(ODataServlet.java:85) [odatav2-lib-1.29.0.jar:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextServletFilter.lambda$doFilter$0(RequestContextServletFilter.java:197) [servlet-2.17.0.jar:na]
    at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextCallable.call(RequestContextCallable.java:131) ~[servlet-2.17.0.jar:na]
    at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextServletFilter.doFilter(RequestContextServletFilter.java:209) [servlet-2.17.0.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90) ~[spring-boot-actuator-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176) ~[spring-security-oauth2-2.0.17.RELEASE.jar:na]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117) ~[spring-boot-actuator-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106) ~[spring-boot-actuator-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:679) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_202]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_202]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at java.lang.Thread.run(Thread.java:836) ~[na:1.8.0_202]
Caused by: java.lang.NullPointerException: while trying to invoke the method java.lang.CharSequence.length() of a null object loaded from field java.util.regex.Matcher.text of an object loaded from local variable 'this'
    at java.util.regex.Matcher.getTextLength(Matcher.java:1283) ~[na:1.8.0_202]
    at java.util.regex.Matcher.reset(Matcher.java:309) ~[na:1.8.0_202]
    at java.util.regex.Matcher.<init>(Matcher.java:229) ~[na:1.8.0_202]
    at java.util.regex.Pattern.matcher(Pattern.java:1093) ~[na:1.8.0_202]
    at com.sap.xs.env.VcapServices.matcher(VcapServices.java:342) ~[xs-env-1.6.9.jar:na]
    at com.sap.xs.env.VcapServices.findServices(VcapServices.java:293) ~[xs-env-1.6.9.jar:na]
    at com.sap.xs.env.VcapServices.findService(VcapServices.java:191) ~[xs-env-1.6.9.jar:na]
    at com.sap.xs.audit.client.impl.v2.AuditLogMessageFactoryImpl.getCredentials(AuditLogMessageFactoryImpl.java:53) ~[audit-java-client-impl-2.0.6.jar:na]
    at com.sap.xs.audit.client.impl.v2.AuditLogMessageFactoryImpl.<init>(AuditLogMessageFactoryImpl.java:34) ~[audit-java-client-impl-2.0.6.jar:na]
    at com.sap.xs.audit.client.impl.v2.AuditLogMessageFactoryImpl.<init>(AuditLogMessageFactoryImpl.java:30) ~[audit-java-client-impl-2.0.6.jar:na]
    at com.sap.cloud.sdk.cloudplatform.auditlog.ScpCfAuditLog.getAuditLogMessageFactory(ScpCfAuditLog.java:58) ~[auditlog-scp-cf-2.17.0.jar:na]
    at com.sap.cloud.sdk.cloudplatform.auditlog.ScpCfAuditLog.<init>(ScpCfAuditLog.java:75) ~[auditlog-scp-cf-2.17.0.jar:na]
    at com.sap.cloud.sdk.cloudplatform.auditlog.ScpCfAuditLogFacade.getAuditLog(ScpCfAuditLogFacade.java:64) ~[auditlog-scp-cf-2.17.0.jar:na]
    at com.sap.cloud.sdk.cloudplatform.auditlog.AuditLogger.getAuditLog(AuditLogger.java:67) ~[auditlog-2.17.0.jar:na]
    at com.sap.cloud.sdk.cloudplatform.auditlog.AuditLogger.logDataRead(AuditLogger.java:445) ~[auditlog-2.17.0.jar:na]
    at com.sap.crun.landscape.LandscapeService.afterQueryTechnicalServices(LandscapeService.java:109) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_202]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_202]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_202]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_202]
    at com.sap.cloud.sdk.service.prov.v2.rt.core.extensions.ExtensionWrappedDataProvider.process(ExtensionWrappedDataProvider.java:460) ~[odata2.core-1.29.0.jar:na]
    at com.sap.cloud.sdk.service.prov.v2.rt.core.extensions.ExtensionDataProvider.checkAndExecuteAfterExit(ExtensionDataProvider.java:1065) ~[odata2.core-1.29.0.jar:na]
    ... 94 common frames omitted

1 Ответ

0 голосов
/ 15 июля 2019

Я изучил трассировку стека вашего сообщения об исключении.Оказывается, эта ошибка может возникнуть, только если у вас есть переменная окружения VCAP Services с записями, в которых отсутствует значение "name" : "...".Пожалуйста, проверьте (и добавьте) значения соответственно.

Для получения дополнительной информации о необходимых / рекомендуемых значениях в записях службы VCAP, пожалуйста, посмотрите на класс com.sap.xs.env.Service и аннотированные свойства:

  • имя (строка)
  • метка (строка)
  • теги (массив строк)
  • план (строка)
  • учетные данные (объект - см. com.sap.xs.env.Credentials)
...