无法加载 servlet 过滤器 class:com.sap.cloud.sdk.cloudplatform.security.servlet.HttpSecurityHeadersFilter (SCP Neo)

Unable to load servlet filter class: com.sap.cloud.sdk.cloudplatform.security.servlet.HttpSecurityHeadersFilter (SCP Neo)

我来寻求帮助解决我在 SCP 中部署应用程序时遇到的问题。

SAP 云平台:

Java 申请:

申请日志如下:

2020 06 14 10:25:49#+00#ERROR#OpenEJB.tomcat##anonymous#localhost-startStop-1#na#fzrl99axqb#anaplaninboundapplication#web##na#na#na#na#
Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[/anaplan-inbound-application] 
org.apache.openejb.OpenEJBException: Unable to load servlet filter class: com.sap.cloud.sdk.cloudplatform.security.servlet.HttpSecurityHeadersFilter: com.sap.cloud.sdk.cloudplatform.security.servlet.HttpSecurityHeadersFilter
    at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:2333)
    at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:2024)
    at org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:384)
    at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
    at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
    at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5065)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1841)
    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)
Caused by: java.lang.ClassNotFoundException: com.sap.cloud.sdk.cloudplatform.security.servlet.HttpSecurityHeadersFilter
    at org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:186)
    at org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:83)
    at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:2330)
    ... 20 common frames omitted

另外,依赖树:

[INFO] --- maven-dependency-plugin:3.1.1:tree (default-cli) @ anaplan-inbound-application ---
[INFO] Verbose not supported since maven-dependency-plugin 3.0
[INFO] com.sunstar:anaplan-inbound-application:war:0.0.1-SNAPSHOT
[INFO] \- com.sap.cloud.sdk.cloudplatform:scp-neo:jar:3.11.0:compile
[INFO]    +- com.sap.cloud.sdk.cloudplatform:auditlog-scp-neo:jar:3.11.0:compile
[INFO]    |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core:jar:3.11.0:compile
[INFO]    |  \- com.sap.cloud.sdk.cloudplatform:auditlog:jar:3.11.0:compile
[INFO]    +- com.sap.cloud.sdk.cloudplatform:caching:jar:3.11.0:compile
[INFO]    |  +- com.sap.cloud.sdk.cloudplatform:security:jar:3.11.0:compile
[INFO]    |  \- com.sap.cloud.sdk.cloudplatform:tenant:jar:3.11.0:compile
[INFO]    +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core-scp-neo:jar:3.11.0:compile
[INFO]    +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity-scp-neo:jar:3.11.0:compile
[INFO]    |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity:jar:3.11.0:compile
[INFO]    |  \- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity-scp:jar:3.11.0:compile
[INFO]    +- com.sap.cloud.sdk.cloudplatform:security-scp-neo:jar:3.11.0:compile
[INFO]    +- com.sap.cloud.sdk.cloudplatform:servlet:jar:3.11.0:compile
[INFO]    +- com.sap.cloud.sdk.cloudplatform:tenant-scp-neo:jar:3.11.0:compile
[INFO]    \- com.sap.cloud.sdk.cloudplatform:metering-scp-neo:jar:3.11.0:compile
[INFO]       \- com.sap.cloud.sdk.cloudplatform:resilience:jar:3.11.0:compile

该应用在使用运行时版本 1.0 时未显示任何问题(在更新之前)。 我使用的是 sdk-bom 版本 3.11.0 。我为3.16.1版本更新了sdk-bom,但没有效果。

使用完全相同原型的其他两个应用程序(SAP Cloud SDK v2 除外)在 SCP 中部署时没有出现错误。

此外,如果运行在本地服务器(本地Neo)中,则不会出现此错误。

请问如何解决这个问题?

BR,

彼得罗

我猜你的应用程序使用了后端保护,对吧?

class com.sap.cloud.sdk.cloudplatform.security.servlet.HttpSecurityHeadersFilter 包含在 Maven 工件中

<dependency>
  <groupId>com.sap.cloud.sdk.cloudplatform</groupId>
  <artifactId>security-servlet</artifactId>
</dependency>

因此请将此依赖项添加到您的项目中并重试。