0

我们已经用 DestinationFacade 和 Destination 的实现覆盖了 AbstractDestinationFacade。当我们尝试通过这个目的地连接时,我们会从 Guava 缓存中获得运行时异常

我们的用例:: 我们正在尝试从 NonCF 平台连接到远程系统。

我们的本地实现如下所示

LocalDestinationFacade

public class LocalDestinationFacade extends AbstractDestinationFacade {


    @Override
    public Class<? extends GenericDestination> getGenericDestinationClass() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Class<? extends Destination> getDestinationClass() {
        // TODO Auto-generated method stub
        return LocalDestination.class;
    }

    @Override
    public Class<? extends RfcDestination> getRfcDestinationClass() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Map<String, GenericDestination> getGenericDestinationsByName() throws DestinationAccessException {
        Destination localDestination=new LocalDestination("AniPremise", "https://custom-backend-corp/",AuthenticationType.BASIC_AUTHENTICATION,new BasicCredentials("adas", "adas"));
        Map<String, GenericDestination> destinations=new HashMap<>();
        destinations.put("AniPremise", localDestination);
        return destinations;
    }


}

本地目的地

public class LocalDestination extends AbstractDestination {

    public LocalDestination(String name, String description, String uri, AuthenticationType authenticationType,
            BasicCredentials basicCredentials, ProxyType proxyType, ProxyConfiguration proxyConfiguration,
            boolean isTrustingAllCertificates, String trustStoreLocation, String trustStorePassword,
            String keyStoreLocation, String keyStorePassword, Map<String, String> propertiesByName) {
        super(name, description, uri, authenticationType, basicCredentials, proxyType, proxyConfiguration,
                isTrustingAllCertificates, trustStoreLocation, trustStorePassword, keyStoreLocation, keyStorePassword,
                propertiesByName);
    }

    public LocalDestination(String name,String uri) {
        this(name, null, uri, null, null, null, null, true, null, null, null, null, Collections.emptyMap());
    }

    public LocalDestination(String name,String uri,AuthenticationType authenticationType,BasicCredentials basicCredentials) {
        this(name, null, uri, authenticationType, basicCredentials,ProxyType.INTERNET , null, false, null, null, null, null, Collections.emptyMap());
    }

    @Override
    public Optional<KeyStore> getTrustStore() throws DestinationAccessException {
        return null;
    }

    @Override
    public Optional<KeyStore> getKeyStore() throws DestinationAccessException {
        return null;
    }

}

当我们查询目标时,会产生以下堆栈跟踪。

com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NullPointerException
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2051)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3953)
    at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4873)
    at com.sap.cloud.sdk.cloudplatform.connectivity.HttpClientCache.getHttpClient(HttpClientCache.java:51)
    at com.sap.cloud.sdk.cloudplatform.connectivity.HttpClientAccessor.getHttpClient(HttpClientAccessor.java:148)
    at com.sap.cloud.sdk.cloudplatform.connectivity.HttpClientAccessor.getHttpClient(HttpClientAccessor.java:128)
    at com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.internalExecute(ODataQuery.java:242)
    at com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.execute(ODataQuery.java:178)
    at com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.execute(ODataQuery.java:227)
    at com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.execute(ODataQuery.java:201)
    at com.sap.cloud.sdk.s4hana.datamodel.odata.helper.FluentHelperRead.execute(FluentHelperRead.java:244)
    at com.sap.gb.s4backend.dataprovider.S4HanaDataProviderImpl.getPurchaseRequisitionWorkList(S4HanaDataProviderImpl.java:473)
    at com.sap.gb.odata.provisioning.GBOdataRequestProcessor.readEntitySet(GBOdataRequestProcessor.java:102)
4

0 回答 0