简体   繁体   中英

NoClassDefFoundError when running local tests with only tenant-scp-neo included in POM

Motivated by this blog entry , I tried to implement multitenancy for our existing application on the classic SAP Neo SCP.

I added the dependency

<dependency>
    <groupId>com.sap.cloud.s4hana.cloudplatform</groupId>
    <artifactId>tenant-scp-neo</artifactId>
    <version>1.9.5</version>
</dependency>

to my POM and accessed the tenant in a test program via

String tenantId = TenantAccessor.getCurrentTenant().getTenantId();

Then, I got this error

java.lang.NoClassDefFoundError: com/google/common/collect/Multiset
    at com.sap.cloud.sdk.cloudplatform.monitoring.ExceptionMonitor.<init>(ExceptionMonitor.java:30) ~[core-1.9.5.jar:na]
    at com.sap.cloud.sdk.cloudplatform.monitoring.ExceptionMonitor.<clinit>(ExceptionMonitor.java:28) ~[core-1.9.5.jar:na]
    at com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory$CloudLogger.<init>(CloudLoggerFactory.java:67) ~[core-1.9.5.jar:na]
    at com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory$CloudLogger.<init>(CloudLoggerFactory.java:47) ~[core-1.9.5.jar:na]
    at com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory.getLogger(CloudLoggerFactory.java:19) ~[core-1.9.5.jar:na]
    at com.sap.cloud.sdk.cloudplatform.tenant.ScpNeoTenantFacade.<clinit>(ScpNeoTenantFacade.java:21) ~[tenant-scp-neo-1.9.5.jar:na]

How can I solve this issue?

After some investigation, it seems that the issue was a corrupt guava jar file in the Maven repository (within the .m2 folder). Deleting the respective folders and having Maven download them again fixed the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM