Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFoundException: jdk.internal.misc.Unsafe #405

Closed
email2liyang opened this issue Jul 15, 2017 · 3 comments
Closed

ClassNotFoundException: jdk.internal.misc.Unsafe #405

email2liyang opened this issue Jul 15, 2017 · 3 comments

Comments

@email2liyang
Copy link

OS : macOS 10.11.6
java version: "1.8.0_111"
testcontainers: 1.4.1

sample test code

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;

public class TransportClientProviderTest {

  private static Logger log = LoggerFactory.getLogger(TransportClientProviderTest.class); //NOPMD
  @Rule
  public GenericContainer esContainer = new GenericContainer("email2liyang/elasticsearch-unit-image:5.4.3")
      .withExposedPorts(9200,9300);


  @Before
  public void setUp() throws Exception {
    String ip = esContainer.getContainerIpAddress();
    Integer transportPort = esContainer.getMappedPort(9300);

    log.info("ip - {}, transportPort - {}",ip,transportPort);
  }

  @After
  public void tearDown() throws Exception {
  }

  @Test
  public void get() throws Exception {
    log.info("I'm just a test");
  }

}

it will report exception like below

TransportClientProviderTest,get
objc[9777]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
14:31:44.517 [main] DEBUG org.testcontainers.utility.TestcontainersConfiguration - Testcontainers configuration overrides will be loaded from file:/Users/ivan/.testcontainers.properties
14:31:44.521 [main] DEBUG org.testcontainers.utility.TestcontainersConfiguration - Testcontainers configuration overrides loaded from TestcontainersConfiguration(properties={docker.client.strategy=org.testcontainers.dockerclient.ProxiedUnixSocketClientProviderStrategy})
14:31:44.551 [main] WARN  org.testcontainers.dockerclient.DockerClientProviderStrategy - Can't instantiate a strategy from org.testcontainers.dockerclient.ProxiedUnixSocketClientProviderStrategy
java.lang.ClassNotFoundException: org.testcontainers.dockerclient.ProxiedUnixSocketClientProviderStrategy
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$0(DockerClientProviderStrategy.java:76)
	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.stream.Streams$StreamBuilderImpl.tryAdvance(Streams.java:405)
	at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294)
	at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
	at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161)
	at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
	at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:728)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.findAny(ReferencePipeline.java:469)
	at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:123)
	at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:93)
	at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:116)
	at io.datanerd.es.guice.TransportClientProviderTest.<init>(TransportClientProviderTest.java:14)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
	at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
14:31:44.613 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
14:31:44.619 [main] DEBUG org.testcontainers.shaded.io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 16
14:31:44.634 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
14:31:44.635 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
14:31:44.636 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
14:31:44.636 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
14:31:44.637 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent0 - direct buffer constructor: available
14:31:44.638 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
14:31:44.641 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable
java.lang.ClassNotFoundException: jdk.internal.misc.Unsafe
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.testcontainers.shaded.io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.testcontainers.shaded.io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:288)
	at org.testcontainers.shaded.io.netty.util.internal.PlatformDependent.getSystemClassLoader(PlatformDependent.java:895)
	at org.testcontainers.shaded.io.netty.util.internal.PlatformDependent.isAndroid0(PlatformDependent.java:919)
	at org.testcontainers.shaded.io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:70)
	at org.testcontainers.shaded.io.netty.channel.kqueue.Native.loadNativeLibrary(Native.java:104)
	at org.testcontainers.shaded.io.netty.channel.kqueue.Native.<clinit>(Native.java:50)
	at org.testcontainers.shaded.io.netty.channel.kqueue.KQueue.<clinit>(KQueue.java:33)
	at org.testcontainers.shaded.io.netty.channel.kqueue.KQueueEventLoopGroup.<clinit>(KQueueEventLoopGroup.java:35)
	at com.github.dockerjava.netty.NettyDockerCmdExecFactory$UnixDomainSocketInitializer.kqueueGroup(NettyDockerCmdExecFactory.java:260)
	at com.github.dockerjava.netty.NettyDockerCmdExecFactory$UnixDomainSocketInitializer.init(NettyDockerCmdExecFactory.java:235)
	at com.github.dockerjava.netty.NettyDockerCmdExecFactory.init(NettyDockerCmdExecFactory.java:206)
	at com.github.dockerjava.core.DockerClientImpl.withDockerCmdExecFactory(DockerClientImpl.java:161)
	at com.github.dockerjava.core.DockerClientBuilder.build(DockerClientBuilder.java:45)
	at org.testcontainers.dockerclient.DockerClientProviderStrategy.getClientForConfig(DockerClientProviderStrategy.java:146)
	at org.testcontainers.dockerclient.UnixSocketClientProviderStrategy.tryConfiguration(UnixSocketClientProviderStrategy.java:65)
	at org.testcontainers.dockerclient.UnixSocketClientProviderStrategy.test(UnixSocketClientProviderStrategy.java:39)
	at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$1(DockerClientProviderStrategy.java:90)
	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267)
	at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:302)
	at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:731)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.findAny(ReferencePipeline.java:469)
	at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:123)
	at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:93)
	at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:116)
	at io.datanerd.es.guice.TransportClientProviderTest.<init>(TransportClientProviderTest.java:14)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
	at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
14:31:44.642 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): available
14:31:44.643 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent - Java version: 8
14:31:44.643 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
14:31:44.643 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: /var/folders/sj/cj0zww0d04x5_jmjmn3d7j7w0000gn/T (java.io.tmpdir)
14:31:44.643 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
14:31:44.644 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
14:31:44.645 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: 3817865216 bytes
14:31:44.645 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
14:31:44.646 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.CleanerJava6 - java.nio.ByteBuffer.cleaner(): available
14:31:44.647 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.NativeLibraryLoader - -Dio.netty.tmpdir: /var/folders/sj/cj0zww0d04x5_jmjmn3d7j7w0000gn/T (java.io.tmpdir)
14:31:44.647 [main] DEBUG org.testcontainers.shaded.io.netty.util.internal.NativeLibraryLoader - -Dio.netty.native.workdir: /var/folders/sj/cj0zww0d04x5_jmjmn3d7j7w0000gn/T (io.netty.tmpdir)
14:31:44.672 [main] DEBUG org.testcontainers.shaded.io.netty.util.NetUtil - -Djava.net.preferIPv4Stack: false
14:31:44.672 [main] DEBUG org.testcontainers.shaded.io.netty.util.NetUtil - -Djava.net.preferIPv6Addresses: false
14:31:44.674 [main] DEBUG org.testcontainers.shaded.io.netty.util.NetUtil - Loopback interface: lo0 (lo0, 0:0:0:0:0:0:0:1)
14:31:44.674 [main] DEBUG org.testcontainers.shaded.io.netty.util.NetUtil - Failed to get SOMAXCONN from sysctl and file /proc/sys/net/core/somaxconn. Default: 128
dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
  Referenced from: /private/var/folders/sj/cj0zww0d04x5_jmjmn3d7j7w0000gn/T/liborg-testcontainers-shaded-netty-transport-native-kqueue3682720021196009616.dylib (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _clock_gettime
  Referenced from: /private/var/folders/sj/cj0zww0d04x5_jmjmn3d7j7w0000gn/T/liborg-testcontainers-shaded-netty-transport-native-kqueue3682720021196009616.dylib (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib


Process finished with exit code 133 (interrupted by signal 5: SIGTRAP)

@email2liyang
Copy link
Author

if I run it in command like I got

 ./gradlew clean test -Dtest.single=TransportClientProviderTest
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :elasticsearch-service:compileJava
Note: /Users/ivan/PIWorks/repos/grpc-mate/elasticsearch-service/src/generated/main/java/io/datanerd/generated/common/Product.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :elasticsearch-service:test
objc[9890]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
  Referenced from: /private/var/folders/sj/cj0zww0d04x5_jmjmn3d7j7w0000gn/T/liborg-testcontainers-shaded-netty-transport-native-kqueue2710420071556020199.dylib (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _clock_gettime
  Referenced from: /private/var/folders/sj/cj0zww0d04x5_jmjmn3d7j7w0000gn/T/liborg-testcontainers-shaded-netty-transport-native-kqueue2710420071556020199.dylib (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

@rnorth
Copy link
Member

rnorth commented Jul 15, 2017

Hi @email2liyang
Yes, as I think you commented on Slack, this looks like a combination of #403 and #402 (you're getting two errors for different reasons).
We're working on these, so if you don't mind I'll close your ticket as a duplicate.
Thank you for reporting, and I hope we can have this fixed for you soon.
Richard

@rnorth rnorth closed this as completed Jul 15, 2017
@email2liyang
Copy link
Author

thanks @rnorth .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants