Connection Exception encountered against sandboxed ledger

So just trying to connect to my sandboxed ledger i.e.

class DamlMain {

static void main(String[] args) {

    def client, ledgerId

    client = newBuilder( "localhost", 6865).build()
    client.connect()
    ledgerId = client.ledgerId
    println "ledger Id: $ledgerId"

}

}

Question , can DAML run under Java 15 ?

here’s the stack:

> Mar 31, 2021 3:36:10 PM io.grpc.internal.ManagedChannelImpl$2 uncaughtException
> SEVERE: [Channel<1>: (localhost:7777)] Uncaught exception in the SynchronizationContext. Panic!
> java.lang.NoSuchMethodError: ‘void io.netty.buffer.PooledByteBufAllocator.(boolean, int, int, int, int, int, int, boolean)’
> at io.grpc.netty.Utils.createByteBufAllocator(Utils.java:172)
> at io.grpc.netty.Utils.access$000(Utils.java:71)
> at io.grpc.netty.Utils$ByteBufAllocatorPreferDirectHolder.(Utils.java:93)
> at io.grpc.netty.Utils.getByteBufAllocator(Utils.java:140)
> at io.grpc.netty.NettyClientTransport.start(NettyClientTransport.java:245)
> at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:33)
> at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:33)
> at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:258)
> at io.grpc.internal.InternalSubchannel.access$400(InternalSubchannel.java:65)
> at io.grpc.internal.InternalSubchannel$2.run(InternalSubchannel.java:200)
> at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95)
> at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127)
> at io.grpc.internal.ManagedChannelImpl$NameResolverListener.onResult(ManagedChannelImpl.java:1790)
> at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333)
> at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
> at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
> at java.base/java.lang.Thread.run(Thread.java:832)

Exception in thread “main” java.lang.RuntimeException: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
at io.reactivex.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:45)
at io.reactivex.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:91)
at io.reactivex.Single.blockingGet(Single.java:2695)
at com.daml.ledger.rxjava.DamlLedgerClient.connect(DamlLedgerClient.java:183)
at com.daml.ledger.rxjava.DamlLedgerClient$connect$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
at com.tb.daml.DamlMain.main(DamlMain.groovy:17)
Caused by: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:564)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:545)
at io.reactivex.internal.operators.flowable.FlowableFromFuture.subscribeActual(FlowableFromFuture.java:42)
at io.reactivex.Flowable.subscribe(Flowable.java:14478)
at io.reactivex.internal.operators.flowable.FlowableSingleSingle.subscribeActual(FlowableSingleSingle.java:39)
at io.reactivex.Single.subscribe(Single.java:3433)
at io.reactivex.internal.operators.single.SingleMap.subscribeActual(SingleMap.java:34)
Caused by: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!


at io.reactivex.Single.subscribe(Single.java:3433)
at io.reactivex.Single.blockingGet(Single.java:2694)
... 6 more


Caused by: io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
Caused by: io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!


at io.grpc.Status.asRuntimeException(Status.java:534)
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:533)
at io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:464)
at io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:428)
at io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:461)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:553)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:68)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:739)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:718)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)


Caused by: java.lang.NoSuchMethodError: ‘void io.netty.buffer.PooledByteBufAllocator.(boolean, int, int, int, int, int, int, boolean)’
Caused by: java.lang.NoSuchMethodError: ‘void io.netty.buffer.PooledByteBufAllocator.(boolean, int, int, int, int, int, int, boolean)’


at io.grpc.netty.Utils.createByteBufAllocator(Utils.java:172)
at io.grpc.netty.Utils.access$000(Utils.java:71)
at io.grpc.netty.Utils$ByteBufAllocatorPreferDirectHolder.<clinit>(Utils.java:93)
at io.grpc.netty.Utils.getByteBufAllocator(Utils.java:140)
at io.grpc.netty.NettyClientTransport.start(NettyClientTransport.java:245)
at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:33)
at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:33)
at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:258)
at io.grpc.internal.InternalSubchannel.access$400(InternalSubchannel.java:65)
at io.grpc.internal.InternalSubchannel$2.run(InternalSubchannel.java:200)
at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95)
at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127)
at io.grpc.internal.ManagedChannelImpl$NameResolverListener.onResult(ManagedChannelImpl.java:1790)
at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333)
... 3 more


Execution failed for task ‘:DamlMain.main()’.

> Process ‘command ‘/home/charles/.sdkman/candidates/java/current/bin/java’’ finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the

1 Like

Hi and thanks for posting this. :slight_smile:

I believe the issue you are facing is caused by using the wrong version of the underlying Netty libraries, likely caused by an incorrect dependency resolution.

Assuming you are using the latest Daml SDK (1.11.1 as of now) the correct Netty version is 4.1.58.Final. Please, make sure you have those on your classpath. Does this resolve your issue?

As for your question regarding the Java version: you should be good with Java 15 according our docs.

2 Likes

I’m pulling in DAML 1.11.1 from Maven Central via Gradle and I"ll assume that those dependencies are set up correctly.

Inspecting the libs pulled in I see a mix of 4.1.58.Final and 4.1.52.Final.

I seem to have a dependency conflict issue due to my pulling in of Spark which is pulling
io.netty:netty-all:4.1.51.Final

I’ll document this here just in case others bump into the same issue in the future:
Daml does seem to pull in some 4.1.58.Final but it seems my Spark dependency overrides others, see pic:

Indeed notice that pulling in of Spark core pulls in Netty all 4.1.51.Final
see pic:

2 Likes

And that was exactly the problem , pulling that Spark version pulled in an earlier version of necessary Spark artifact,

Now running the code above provides the confirmation:

Task :DamlMain.main()
ledger Id: 5f2927eb-b4fc-464c-af4f-d5b3a15dea38

thanks for the help

4 Likes