Cannot connect to the ledger server, error: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
- XuyxOP 1
I installed postgresql, and tried to startup with
daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575 --query-store-jdbc-config "driver=org.postgresql.Driver,url=jdbc:postgresql://localhost:5432/postgres?&ssl=false,user=postgres,password=123qwe,createSchema=false"It failed and exited.
15:13:09.890 [main] INFO com.daml.http.Main$ - Config(ledgerHost=localhost, ledgerPort=6865,address=127.0.0.1, httpPort=7575, portFile=None, packageReloadInterval=5 seconds,packageMaxInboundMessageSize=None,maxInboundMessageSize=4194304,tlsConfig=TlsConfiguration(false,None,None,None,REQUIRE), jdbcConfig=Some(JdbcConfig(driver=org.postgresql.Driver, url=jdbc:postgresql://localhost:5432/postgres?&ssl=false, user=postgres, createSchema=false)), staticContentConfig=None, allowNonHttps=false, accessTokenFile=None, wsConfig=None) 15:13:10.194 [http-json-ledger-api-akka.actor.default-dispatcher-4] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started 15:13:16.530 [http-json-ledger-api-akka.actor.default-dispatcher-13] ERROR com.daml.http.Main$ - Cannot start server: Error(Cannot connect to the ledger server, error: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception) 15:13:16.582 [shutdownHook2] INFO com.daml.http.HttpService$ - Stopping server... daml-helper: Received ExitFailure 101 when running Raw command: java "-Dlogback.configurationFile=C:\\Users\\Xuyx\\AppData\\Roaming\\daml\\sdk\\1.7.0\\daml-sdk\\json-api-logback.xml" -jar "C:\\Users\\Xuyx\\AppData\\Roaming\\daml\\sdk\\1.7.0\\daml-sdk\\daml-sdk.jar" json-api --ledger-host localhost --ledger-port 6865 --http-port 7575 --query-store-jdbc-config driver=org.postgresql.Driver,url=jdbc:postgresql://localhost:5432/postgres?&ssl=false,user=postgres,password=123qwe,createSchema=falseWhat should I do to let it run successfully?
- cocreature
Cannot connect to ledger servermeans that the JSON API failed to connect to the underlying ledger, e.g., DAML on SQL. Do you have a ledger running? If so double check that it’s running on port 6865. If you don’t have a ledger running, you can use sandbox for development which you can start usingdaml sandbox. You might also be interested indaml startwhich will automatically start Sandbox and the JSON API to provide you with an easy development setup. - Xuyx 1
Thanks.I’m trying to let my project to go with database, and meet new problems.
First, I try to add the following to daml.yaml, and run daml startsandbox-options: - --wall-clock-time - --ledgerid=Currency-sandbox - --sql-backend-jdbcurl=jdbc:postgresql://localhost:5432/postgres?user=postgres&password=123qweIt shows “ERROR: Shutting down because of an initialization error.
org.flywaydb.core.api.FlywayException: Found non-empty schema(s) “public” but no schema history table. Use baseline() or set baselineOnMigrate to true to initialize the schema history table.”On the other hand, I run the followings,
daml sandbox .daml\dist\Currency-1.0.0.dar --ledgerid=Currency-sandbox daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575 --query-store-jdbc-config "driver=org.postgresql.Driver,url=jdbc:postgresql://localhost:5432/postgres?&ssl=false,user=postgres,password=123qwe,createSchema=true" --allow-insecure-tokens=trueand it told me at the front-end “JsonError: Cannot resolve template ID, given: Temp…a3f7018cf68ba885f8be25f6080617b),Currency,Issuer)”.
All request failed at front-end. - cocreature 1
Cannot resolve template IDusually means that the template you are referencing has not been uploaded to the ledger. There can be various reasons for that:- Simple typos if you constructed the template id yourself.
- Forgetting to upload the package.
- Making a change to the DAML model after uploading it and rebuilding it. In that case, your client code will reference the template in the updated DAR while the ledger only knows about the original template. You have to upload the new DAR/restart the ledger with the new DAR.
I’m not quite sure about the first error, let me get back to you.
- gerolf 4
Xuyx:It shows “ERROR: Shutting down because of an initialization error.
org.flywaydb.core.api.FlywayException: Found non-empty schema(s) “public” but no schema history table. Use baseline() or set baselineOnMigrate to true to initialize the schema history table.”Hi @Xuyx,
This error basically says that you are runningdaml sandboxwith a database that was previously runningdaml sandbox-classic. You’ll need to start with a fresh DB schema.HTH
- Xuyx
@gerolf. Thank you, my project run successfully after starting with a fresh DB schema.
- Xuyx
Thanks. I solve it now. I missed “–sql-backend-jdbcurl” when I ran
daml sandbox .daml\dist\Currency-1.0.0.dar --ledgerid=Currency-sandbox