Skip to content
Discussions/App Development/Sandbox persistenceForum ↗

Sandbox persistence

App Development7 posts132 views2 likesLast activity Apr 2022
DE
DerekOP
Apr 2022

Hello daml community,

I am trying to set persistence to my ledger and, at the same time, run my json api.
Using DAML Driver for Postgres i can accomplish persistence:

java -jar daml-on-sql-1.17.1.jar --ledgerid=test --sql-backend-jdbcurl=“jdbc:postgresql://localhost/damltest?user=daml&password=daml”

Then i run json api:
daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575

I try to create my contracts with my Java aplication and i get this error:

HTTP 500 Internal Server Error

However, when i dont use persistence (following commands), i can create contracts, with my java aplication, and view them in navigator. RESPONSE: HTTP 200 OK

daml sandbox --wall-clock-time --ledgerid test_ledger ./.daml/dist/test-0.0.1.dar

daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575

CO
cocreature
Apr 2022

Can you share the logs for both daml on SQL and for the JSON API?
Note also that 1.17.1 is fairly old at this point. I recommend switch to 2.1 although your setup should work on 1.17 as wlel.

DE
Derek
Apr 2022


POSTGRES

DE
Derek
Apr 2022


JSON API ERROR

DE
Derek
Apr 2022

Command: daml start

JSON API RESPONDING 200 OK

DE
Derek
Apr 2022

Ok i did it, i used this commands, now i can store my ledger in postgres while running json api:

daml deploy --host localhost --port 6865

daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575 --allow-insecure-tokens

java -jar daml-on-sql-1.17.1.jar --ledgerid=test_ledger --sql-backend-jdbcurl=“jdbc:postgresql://localhost/test2?user=test2&password=test2”

daml navigator server --port 7500

CO
cocreature
Apr 2022

Ah right that’s expected, you need to upload the package first. I believe if you look at the full error returned by the JSON API it should tell you that it couldn’t find the template or something along those lines.

← Back to Discussions