在SCP Neo中使用S4 SDK部署我的项目导致错误

时间:2019-02-25 01:34:09

标签: s4sdk

我想在SCP Neo中现有的Java项目中使用S / 4 HANA SDK。建议我生成一个新项目,然后将现有代码移至应用程序下生成的项目。 我生成了一个新项目,该项目具有S / 4 HANA SDK教程第2步中指定的架构师类型,并将现有代码复制到应用程序模块中。当我尝试在SCP Neo中部署应用程序并尝试启动它时。它没有启动,并且在SCP日志中,我看到了以下错误。 请告知如何解决? (我的现有人员也使用记录器)。

最诚挚的问候

Fred Z

24 Feb 23:14:15 UTC - org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/s4scheduler-application]
2019 02 24 23:14:15#+00#ERROR#org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/s4scheduler-application]##anonymous#localhost-startStop-1#na#ogfigrvps3#s4schedulerapplication#web##na#na#na#na#Error configuring application listener of class [com.sap.cloud.sdk.s4hana.connectivity.ErpDestination] java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader "<unnamed>" (instance of org.apache.catalina.loader.ParallelWebappClassLoader@3b3235ca, child of java.net.URLClassLoader@61baa894) of the current class, org/slf4j/LoggerFactory, and the class loader "System" (instance of sun.misc.Launcher$AppClassLoader@277050dc, child of sun.misc.Launcher$ExtClassLoader@2b71fc7e, urls: 'file:/usr/lib/jvm/sapjvm_8/sapjvm_8/lib/jvmx.jar', 'file:/usr/lib/jvm/sapjvm_8/sapjvm_8/lib/tools.jar', 'file:/usr/sap/ljs/bin/jul-to-slf4j.jar', 'file:/usr/sap/ljs/bin/slf4j-api.jar', 'file:/usr/sap/ljs/bin/logback-classic.jar', 'file:/usr/sap/ljs/bin/logback-core.jar', 'file:/usr/sap/ljs/bin/logback-config/', 'file:/usr/sap/ljs/bin/com.sap.core.js.logging.jar', 'file:/usr/sap/ljs/bin/bootstrap.jar', 'file:/usr/sap/ljs/bin/tomcat-juli.jar') for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:418)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
at com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory.<clinit>(CloudLoggerFactory.java:21)
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationDeclarator.<clinit>(DestinationDeclarator.java:29)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:151)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4714)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:985)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:836)

1 个答案:

答案 0 :(得分:2)

解决方案

根据some.other.group.id:some-other-artifact-id是否在您的控制之下,您有两个选项,其中选项1是首选。

  1. 如果可以更改some-other-artifact-id的依赖项,请删除范围为compileprovided的所有具体记录器实现,然后将其替换为slf4j-api。如有必要,例如对于测试,可以在范围testruntime中使用具体的实现。这通常是库的最佳实践,因为库无法知道在使用该库构建的实际应用程序中使用了哪个实际记录器。

  2. 如果您无法直接控制some-other-artifact-id中的依赖项,则可以通过在dependencies的{​​{1}}块中添加以下内容来删除依赖项:

    pom.xml

背景

依赖关系树的重要部分摘录如下:

<dependency>
    <groupId>some.other.group.id</groupId>
    <artifactId>some-other-artifact-id</artifactId>
    <exclusions>
        <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency>

您对类路径具有[INFO] --- maven-dependency-plugin:3.1.1:tree (default-cli) @ some-application --- [INFO] some.group.id:some-artifact-id:jar:1.0 ... [INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile [INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.25:runtime [INFO] +- some.other.group.id:some-other-artifact-id:jar:1.0:compile ... [INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.6:compile [INFO] | | \- commons-logging:commons-logging:jar:1.2:compile ... jcl-over-slf4j依赖性。由于第一个是第二个的“直接替换”,因此您现在基本上具有针对同一类的两组实现,这会导致运行时错误。

进一步阅读