Am getting below exception when trying to run integration test which has TestCOntainers GenerciContainer for redis
public GenericContainer redis = new GenericContainer<>("redis:3.0.6")
.withExposedPorts(6379);
Exception
java.lang.NoClassDefFoundError: com/sun/jna/Platform
at org.rnorth.ansi.CapabilityDetection.isTty(CapabilityDetection.java:38)
at org.rnorth.ansi.AnsiLite.isEnabled(AnsiLite.java:169)
at org.rnorth.ansi.AnsiLite.toString(AnsiLite.java:134)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at org.rnorth.visibleassertions.VisibleAssertions.info(VisibleAssertions.java:59)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:129)
at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:142)
at com.target.sparkbulkapp.IntegrationTest.$spock_initializeFields(IntegrationTest.groovy:51)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Platform
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 9 more
in general if we add testcontainers depdency it will bring jna depdency also , but in my case it is not below the image
If you see here only jna-platform is bring in not jna , and my issue of class not found excpetion for Platform is because of this only , i asked my team member to add this testcontainers , then i saw jna is being added in this case , what might be reason why it is not added in my case