← All tasks
javamock-server/mockserver-monorepo #1396Not a task: not reproduced

Using mockserver-client-java-no-dependencies causes package collision with com.google.common.cache

envgap__mock-server__mockserver-monorepo-1396

01 / FAILURE SIGNATURE

As reported upstream

com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchFieldError: ASCII
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
61ceef4951bc142b18d649835584c763853e9243
Manifest
mockserver-client-java/pom.xml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

mock-server/mockserver-monorepo #1396 · read the original issue
**Describe the issue**

When using Guava cache , and after replacing the `mockserver-client-java` dependency with `mockserver-client-java-no-dependencies` dependency we get the following error:

```

com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchFieldError: ASCII

 	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2053) ~[mockserver-client-java-no-dependencies-5.13.2.jar:na]

 	at com.google.common.cache.LocalCache.get(LocalCache.java:3966) ~[mockserver-client-java-no-dependencies-5.13.2.jar:na]

 	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3989) ~[mockserver-client-java-no-dependencies-5.13.2.jar:na]

 	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4950) ~[mockserver-client-java-no-dependencies-5.13.2.jar:na]

 	at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4956) ~[mockserver-client-java-no-dependencies-5.13.2.jar:na]

```



**Workaround**

I built `mockserver-client-java-no-dependencies:5.13.2` locally, with a minimal change to shading:

```

<relocation>

   <pattern>com.google</pattern>

   <shadedPattern>shaded_package.com.google</shadedPattern>

</relocation>

```

This seems to resolve the issue (The right jar is being used for the Guava package). I wonder why `com.google` is intentionally not relocated ?



**What you are trying to do**

I am implementing an integration test that involves a few test containers , including a mockserver test container and a mockserver client to configure it. We are using the `mockserver-client-java` dependency but it causes us a few problems with transitive dependencies so `mockserver-client-java-no-dependencies` seems like a natural solution to the problem and we would like to use it instead if possible. 



**MockServer version**

5.13.2



**To Reproduce**

1. Have a project with the following dependencies:

```

        <dependency>

            <groupId>com.google.guava</groupId>

            <artifactId>guava</artifactId>

            <version>19.0</version>

        </dependency>

        <dependency>

            <groupId>org.mock-server</groupId>

            <artifactId>mockserver-client-java-no-dependencies</artifactId>

            <version>5.13.2</version>

            <scope>test</scope>

        </dependency>

```



2. Create a Guava LoadingCache and use it.
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]