‎2024 Sep 11 2:10 PM - edited ‎2024 Sep 12 7:03 AM
We have developed a Java-servlet based extension application for SAP SuccessFactors. Our deployment package includes both the Java application and the Approuter application, which customers deploy through the SAP BTP Cloud Foundry environment. We use Approuter for authentication, and once a request is successfully authenticated, it is forwarded to our Java application.
Although the application generally operates smoothly, one of our customers occasionally experiences the issue described below (which may occur once a month or even more frequently). This problem is resolved when the application is manually restarted.
Could you please assist us in identifying the root cause of this issue?
java.lang.NoClassDefFoundError: Could not initialize class com.sap.cloud.security.token.Token
2024-09-06T05:01:16.834+0000 [APP/PROC/WEB/0] STDOUT {"msg":"Error processing request","level":"ERROR","written_ts":"1725598876833000000","logger":"org.apache.coyote.http11.Http11Processor","exception_type":"java.lang.NoClassDefFoundError","written_at":"2024-09-06T05:01:16.833Z","thread":"http-nio-0.0.0.0-8080-exec-5","type":"log","exception_message":"Could not initialize class com.sap.cloud.security.token.Token","stacktrace":["java.lang.NoClassDefFoundError: Could not initialize class com.sap.cloud.security.token.Token","\tat com.sap.xs.security.UserInfoFactory.createXsuaaToken(UserInfoFactory.java:105)","\tat com.sap.xs.security.UserInfoFactory.checkAndSetXsuaaToken(UserInfoFactory.java:46)","\tat com.sap.xs.security.UserInfoValve.invoke(UserInfoValve.java:17)","\tat com.sap.xs.statistics.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:43)","\tat com.sap.xs.logging.catalina.RuntimeInfoValve.invoke(RuntimeInfoValve.java:42)","\tat org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:765)","\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)","\tat org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390)","\tat org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)","\tat org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)","\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1790)","\tat org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)","\tat org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)","\tat org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)","\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)","\tat java.lang.Thread.run(Thread.java:838)","Caused by: java.lang.ExceptionInInitializerError: Exception java.util.ServiceConfigurationError: com.sap.cloud.security.token.TokenFactory: Provider com.sap.cloud.security.servlet.HybridTokenFactory not a subtype [in thread \"http-nio-0.0.0.0-8080-exec-1\"]","\tat java.util.ServiceLoader.fail(ServiceLoader.java:239)","\tat java.util.ServiceLoader.access$300(ServiceLoader.java:185)","\tat java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)","\tat java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)","\tat java.util.ServiceLoader$1.next(ServiceLoader.java:480)","\tat java.lang.Iterable.forEach(Iterable.java:74)","\tat com.sap.cloud.security.token.Token$1.<init>(Token.java:31)","\tat com.sap.cloud.security.token.Token.<clinit>(Token.java:29)","\tat com.sap.cloud.connectivity.apiext.cloud.destinationservice.DestinationServiceClient.getDestinationServiceAccessToken(DestinationServiceClient.java:77)","\tat com.sap.cloud.connectivity.apiext.cloud.destinationservice.DestinationServiceClient.getAuthorizationToken(DestinationServiceClient.java:121)","\tat com.sap.cloud.connectivity.apiext.cloud.destinationservice.DestinationServiceClient.findDestination(DestinationServiceClient.java:114)","\tat com.sap.cloud.connectivity.apiext.cloud.configuration.datasource.CloudDataSourceImpl.getDestinationConfiguration(CloudDataSourceImpl.java:41)","\tat com.sap.core.connectivity.apiext.impl.cache.AbstractDataSourceCache$1.compute(AbstractDataSourceCache.java:88)","\tat com.sap.core.connectivity.apiext.impl.cache.AbstractDataSourceCache$1.compute(AbstractDataSourceCache.java:72)","\tat com.sap.core.connectivity.apiext.impl.cache.util.Memoizer$1.call(Memoizer.java:109)","\tat com.sap.core.connectivity.apiext.impl.cache.util.Memoizer$1.call(Memoizer.java:105)","\tat com.sap.core.connectivity.apiext.impl.cache.CircuitBreakerFutureExecutor.execute(CircuitBreakerFutureExecutor.java:44)","\tat com.sap.core.connectivity.apiext.impl.cache.AbstractDataSourceCache$DatasourceMemoizer$2.call(AbstractDataSourceCache.java:297)","\tat com.sap.core.connectivity.apiext.impl.cache.AbstractDataSourceCache$DatasourceMemoizer$2.call(AbstractDataSourceCache.java:294)","\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)","\tat com.sap.core.connectivity.apiext.impl.cache.util.PeriodicFutureExecutor.runTask(PeriodicFutureExecutor.java:60)","\tat com.sap.core.connectivity.apiext.impl.cache.util.PeriodicFutureExecutor.execute(PeriodicFutureExecutor.java:49)","\tat com.sap.core.connectivity.apiext.impl.cache.util.Memoizer.compute(Memoizer.java:79)","\tat com.sap.core.connectivity.apiext.impl.cache.AbstractDataSourceCache.computeFromMemoizer(AbstractDataSourceCache.java:160)","\tat com.sap.core.connectivity.apiext.impl.cache.AbstractDataSourceCache.getDestinationConfiguration(AbstractDataSourceCache.java:230)","\tat com.sap.core.connectivity.apiext.impl.cache.AbstractDataSourceCache.getDestinationConfiguration(AbstractDataSourceCache.java:220)","\tat com.sap.core.connectivity.apiext.impl.configuration.reader.DataSourceConfigurationReader.readDestinationConfiguration(DataSourceConfigurationReader.java:22)","\tat com.sap.core.connectivity.apiext.impl.configuration.provider.AbstractConfigurationProvider$1.load(AbstractConfigurationProvider.java:58)","\tat com.sap.core.connectivity.apiext.impl.configuration.provider.AbstractConfigurationProvider$1.load(AbstractConfigurationProvider.java:54)","\tat com.sap.core.connectivity.apiext.impl.configuration.provider.AbstractConfigurationProvider.provide(AbstractConfigurationProvider.java:179)","\tat com.sap.core.connectivity.apiext.impl.configuration.provider.AbstractConfigurationProvider.provideDestinationConfiguration(AbstractConfigurationProvider.java:67)","\tat com.sap.core.connectivity.apiext.impl.configuration.provider.AbstractConfigurationProvider.getDestinationConfiguration(AbstractConfigurationProvider.java:54)","\tat com.sap.core.connectivity.apiext.impl.configuration.AbstractConnectivityConfiguration.getConfiguration(AbstractConnectivityConfiguration.java:60)","\tat com.sap.core.connectivity.apiext.impl.configuration.AbstractConnectivityConfiguration.getConfiguration(AbstractConnectivityConfiguration.java:46)"
manifest.yml :
---
# Extension application
- name: sf-extension
memory: 900M
timeout: 300
routes:
- route: sfextension.cfapps.us10-001.hana.ondemand.com
path: SfExtension.war
buildpacks:
- sap_java_buildpack
env:
TARGET_RUNTIME: tomcat
USE_CONNECTIVITY_APIEXT: true
APP_ROUTER_URL: https://websfextension.cfapps.us10-001.hana.ondemand.com
SET_LOGGING_LEVEL: "{ROOT: DEBUG}"
services:
- xsuaa
- destination
- sap_hcmcloud_core_odata
- connectivity
# Application Router
- name: approuter-sf-extension
path: approuter
buildpacks:
- nodejs_buildpack
memory: 124M
routes:
- route: websfextension.cfapps.us10-001.hana.ondemand.com
services:
- xsuaa
env:
destinations: >
[
{"name":"sap_hcmcloud_core_odata",
"url":"https://sfextension.cfapps.us10-001.hana.ondemand.com",
"forwardAuthToken": true}
]
mvn dependency:tree
[INFO] +- commons-validator:commons-validator:jar:1.7:compile
[INFO] | +- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] +- com.google.code.gson:gson:jar:2.9.0:compile
[INFO] +- javax.ws.rs:javax.ws.rs-api:jar:2.1:compile
[INFO] +- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] +- com.sun.jersey:jersey-client:jar:1.19.4:compile
[INFO] +- com.sun.jersey:jersey-core:jar:1.19.4:compile
[INFO] +- com.sun.jersey.contribs:jersey-multipart:jar:1.19.4:compile
[INFO] | \- org.jvnet.mimepull:mimepull:jar:1.9.3:compile
[INFO] +- commons-codec:commons-codec:jar:1.13:compile
[INFO] +- commons-io:commons-io:jar:2.11.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.14.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.14.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.14.1:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.14.1:compile
[INFO] +- joda-time:joda-time:jar:2.10.3:compile
[INFO] | \- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] +- com.github.librepdf:openpdf:jar:1.3.28:compile
[INFO] +- com.sap.cloud.db.jdbc:ngdbc:jar:2.13.9:compile
[INFO] +- com.sap.cloud.security:java-security:jar:2.13.4:compile
[INFO] | +- com.sap.cloud.security:java-api:jar:2.13.4:compile
[INFO] | +- com.sap.cloud.security:env:jar:2.13.4:compile
[INFO] | | +- com.sap.cloud.environment.servicebinding:java-sap-vcap-services:jar:0.10.1:compile
[INFO] | | | \- com.sap.cloud.environment.servicebinding.api:java-core-api:jar:0.10.1:compile
[INFO] | | +- com.sap.cloud.environment.servicebinding:java-sap-service-operator:jar:0.10.1:compile
[INFO] | | +- com.sap.cloud.environment.servicebinding.api:java-consumption-api:jar:0.10.1:compile
[INFO] | | \- com.sap.cloud.environment.servicebinding.api:java-access-api:jar:0.10.1:compile
[INFO] | \- com.sap.cloud.security.xsuaa:token-client:jar:2.13.4:compile
[INFO] | +- com.sap.cloud.security.xsuaa:api:jar:2.13.4:compile
[INFO] | \- com.github.ben-manes.caffeine:caffeine:jar:2.9.3:compile
[INFO] | +- org.checkerframework:checker-qual:jar:3.19.0:compile
[INFO] | \- com.google.errorprone:error_prone_annotations:jar:2.10.0:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- com.sun.xml.bind:jaxb-core:jar:2.3.0:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.3.2:compile
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.8.2:test
[INFO] | | +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] | | \- org.junit.platform:junit-platform-commons:jar:1.8.2:test
[INFO] | +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:test
[INFO] | \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] +- org.mockito:mockito-core:jar:4.6.1:test
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.12.10:test
[INFO] | +- net.bytebuddy:byte-buddy-agent:jar:1.12.10:test
[INFO] | \- org.objenesis:objenesis:jar:3.2:test
[INFO] +- org.mockito:mockito-inline:jar:4.6.1:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:4.6.1:test
[INFO] +- com.h2database:h2:jar:2.1.214:test
[INFO] +- javax.websocket:javax.websocket-api:jar:1.1:provided
[INFO] +- javax.servlet.jsp:javax.servlet.jsp-api:jar:2.3.1:provided
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] +- org.slf4j:slf4j-api:jar:1.7.28:provided
[INFO] +- com.sap.xs:java-js-client:jar:1.7.2:provided
[INFO] | +- org.slf4j:slf4j-simple:jar:1.7.36:provided
[INFO] | \- org.apache.commons:commons-lang3:jar:3.12.0:provided
[INFO] \- com.sap.cloud:neo-java-web-api:jar:3.154.5:provided
[INFO] +- org.apache.chemistry.opencmis:chemistry-opencmis-commons-api:jar:1.0.0:provided
[INFO] +- javax.el:javax.el-api:jar:3.0.0:provided
[INFO] +- org.apache.chemistry.opencmis:chemistry-opencmis-client-api:jar:1.0.0:provided
[INFO] +- javax.mail:javax.mail-api:jar:1.5.5:provided
[INFO] \- org.glassfish:javax.annotation:jar:3.1-b41:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
Request clarification before answering.
Hi @gp5 ,
Since the local build is successful, the following points can be reviewed to debug the issue:
Please verify if the com.sap.cloud.security dependency is available in the central repository. There might be a possibility that the required library is present locally but not in the central repository, which could result in the class not being identified after deployment.
Ensure that the version of the com.sap.cloud.security library is compatible with your Java version and other dependencies in the project. You can use the Maven dependency:tree or Gradle dependencies task to identify any potential conflicts between different versions of the same library.
I hope this helps.
Best Regards,
Anjali Pathak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.