Not able to connect to daml server using DamlLedgerClient

I was trying to connect to daml sandbox using DamlLedgerClient.

DamlLedgerClient client = DamlLedgerClient.newBuilder(host,port).build();

But getting following error:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V
	at io.grpc.Metadata$Key.validateName(Metadata.java:629)
	at io.grpc.Metadata$Key.<init>(Metadata.java:637)
	at io.grpc.Metadata$Key.<init>(Metadata.java:567)
	at io.grpc.Metadata$AsciiKey.<init>(Metadata.java:742)
	at io.grpc.Metadata$AsciiKey.<init>(Metadata.java:737)
	at io.grpc.Metadata$Key.of(Metadata.java:593)
	at io.grpc.Metadata$Key.of(Metadata.java:589)
	at io.grpc.internal.GrpcUtil.<clinit>(GrpcUtil.java:86)
	at io.grpc.internal.AbstractManagedChannelImplBuilder.<clinit>(AbstractManagedChannelImplBuilder.java:84)
	at com.daml.ledger.rxjava.DamlLedgerClient.newBuilder(DamlLedgerClient.java:80)

In my pom.xml file I am using following dependancy:

 <dependency>
            <groupId>com.daml</groupId>
            <artifactId>bindings-rxjava</artifactId>
            <version>1.6.0</version>
        </dependency>
        <dependency>
            <groupId>com.daml</groupId>
            <artifactId>daml-lf-1.8-archive-java-proto</artifactId>
            <version>1.6.0</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>
1 Like

Do you have any other dependencies? Looking through java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument · Issue #5258 · grpc/grpc-java · GitHub and https://stackoverflow.com/questions/42206440/java-lang-nosuchmethoderror-com-google-common-base-preconditions-checkargument it seems like this is probably caused by some inconsistency around the guava dependency. If you don’t already depend on guava, you could also try adding it although I’m not quite sure why the dependency isn’t picked up automatically.

1 Like