我在尝试创建ErpConfigContext
. 有谁知道为什么会这样?
代码片段:
@Bean
public ErpConfigContext erpConfigContext() {
return new ErpConfigContext("S4HANA_CLOUD");
}
堆栈跟踪:
*Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext]: Factory method 'erpConfigContext' threw exception; nested exception is java.lang.ClassCastException: Cannot cast class com.sap.core.connectivity.apiext.cloud.configuration.CloudConnectivityConfiguration to interface com.sap.core.connectivity.api.configuration.ConnectivityConfiguration
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 59 common frames omitted*
*Caused by: java.lang.ClassCastException: **Cannot cast class com.sap.core.connectivity.apiext.cloud.configuration.CloudConnectivityConfiguration to interface com.sap.core.connectivity.api.configuration.ConnectivityConfiguration**
at com.sap.cloud.sdk.cloudplatform.connectivity.ScpNeoDestinationFacade.lookupConnectivityConfiguration(ScpNeoDestinationFacade.java:40)
at com.sap.cloud.sdk.cloudplatform.connectivity.ScpNeoDestinationFacade.getConnectivityConfiguration(ScpNeoDestinationFacade.java:59)
at com.sap.cloud.sdk.cloudplatform.connectivity.ScpNeoDestinationFacade.getDestinationConfiguration(ScpNeoDestinationFacade.java:69)
at com.sap.cloud.sdk.cloudplatform.connectivity.ScpNeoDestinationFacade.getGenericDestination(ScpNeoDestinationFacade.java:105)
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationAccessor.getGenericDestination(DestinationAccessor.java:146)
at com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext.<init>(ErpConfigContext.java:209)
at com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext.<init>(ErpConfigContext.java:355)
at com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext.<init>(ErpConfigContext.java:429)
at com.sap.csc.timebackend.config.S4Beans.erpConfigContext(S4Beans.java:20)
at com.sap.csc.timebackend.config.S4Beans$$EnhancerBySpringCGLIB$$5076fc70.CGLIB$erpConfigContext$1(<generated>)
at com.sap.csc.timebackend.config.S4Beans$$EnhancerBySpringCGLIB$$5076fc70$$FastClassBySpringCGLIB$$bc447478.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at com.sap.csc.timebackend.config.S4Beans$$EnhancerBySpringCGLIB$$5076fc70.erpConfigContext(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 60 common frames omitted*