This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-05
Channels
- # aws (6)
- # beginners (10)
- # boot (33)
- # cider (23)
- # cljs-dev (50)
- # cljsjs (2)
- # cljsrn (10)
- # clojars (1)
- # clojure (215)
- # clojure-czech (1)
- # clojure-dev (5)
- # clojure-italy (23)
- # clojure-russia (18)
- # clojure-spec (11)
- # clojure-uk (53)
- # clojurescript (157)
- # core-async (29)
- # cursive (12)
- # data-science (15)
- # datascript (16)
- # datomic (68)
- # graphql (2)
- # jobs (5)
- # jobs-discuss (1)
- # juxt (17)
- # lein-figwheel (2)
- # luminus (3)
- # off-topic (155)
- # om (3)
- # pedestal (1)
- # portkey (1)
- # re-frame (7)
- # reagent (4)
- # ring (3)
- # ring-swagger (2)
- # rum (11)
- # unrepl (11)
- # vim (1)
- # yada (2)
Hi everyone! I’m having a problem with datomic client. I’m playing with a small app to get some play time with datomic. But the moment I try to add the datomic client dependency my project breaks this is my project file:
clojure
(defproject rail-cards-api "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.8.0"]
[metosin/compojure-api "1.1.10"]
[buddy/buddy-core "1.2.0"]
[com.datomic/clj-client "0.8.606"]
[org.clojure/core.async "0.3.443"]]
:ring {:handler rail-cards-api.handler/app}
:uberjar-name "server.jar"
:profiles {:dev [:project/dev :profiles/dev]
:project/dev {:dependencies [[javax.servlet/javax.servlet-api "3.1.0"]
[cheshire "5.5.0"]
[ring/ring-mock "0.3.0"]]
:plugins [[lein-ring "0.10.0"]]}
:profiles/dev {}})
and this is the error i get:
bash
lein ring server
2017-06-04 23:44:35.300:INFO::main: Logging initialized @1619ms
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/http/HttpParser$ProxyHandler, compiling:(ring/adapter/jetty.clj:27:11)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6875)
at clojure.lang.Compiler.analyze(Compiler.java:6669)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856)
at clojure.lang.Compiler.analyze(Compiler.java:6669)
at clojure.lang.Compiler.analyze(Compiler.java:6625)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6001)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868)
at clojure.lang.Compiler.analyze(Compiler.java:6669)
at clojure.lang.Compiler.analyze(Compiler.java:6625)
at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2797)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868)
at clojure.lang.Compiler.analyze(Compiler.java:6669)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856)
at clojure.lang.Compiler.analyze(Compiler.java:6669)
it seems to have a problem with the ring plugin? This happens the seccond I add the [com.datomic/clj-client “0.8.606”] dependency. Tests still run fine though…
Am I doing it wrong?I’m thinking that perhaps I need to include the datomic dependency differently? The one on Maven seems to be quite old.
I have got this error early time, both ring
& clj-client
depends on jetty
, you need fix the conflicts of dependencies. use lein deps :tree
show the confilict.
Thank you @isaac will do that. New to clojure didn’t think to check the dependency tree:)
Got it to build like this:
(defproject rail-cards-api "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.8.0"]
[metosin/compojure-api "1.1.10"]
[buddy/buddy-core "1.2.0"]
[com.datomic/clj-client "0.8.606" :exclusions [org.eclipse.jetty/jetty-client
org.eclipse.jetty/jetty-http
org.eclipse.jetty/jetty-util]]
[org.clojure/core.async "0.3.443"]
[org.eclipse.jetty/jetty-util "9.2.21.v20170120"]
[org.eclipse.jetty/jetty-http "9.2.21.v20170120"]
[org.eclipse.jetty/jetty-util "9.2.21.v20170120"]]
:ring {:handler rail-cards-api.handler/app}
:uberjar-name "server.jar"
:profiles {:dev [:project/dev :profiles/dev]
:project/dev {:dependencies [[javax.servlet/javax.servlet-api "3.1.0"]
[cheshire "5.7.1"]
[ring/ring-mock "0.3.0"]]
:plugins [[lein-ring "0.12.0"]]}
:profiles/dev {}})
is there a way to apply the exclusions for datomic client just in the dev profile while loading them in a production scenario? The conflict seems to be with lein-ring plugin. I will probably not be using that in a production environment right?
I guess what I’m asking is if a dependency added in the profiles overrides the one in the project?
dependencies declared higher (closer to your project) in the dep tree override ones declared lower @nadejde
@nadejde http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html The sections "transitive dependencies" and "dependency scope" apply
Hi. Thank you. Ended up with this:
(defproject rail-cards-api "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.8.0"]
[metosin/compojure-api "1.1.10"]
[buddy/buddy-core "1.2.0"]
[com.datomic/clj-client "0.8.606" ]
[org.clojure/core.async "0.3.443"]]
:ring {:handler rail-cards-api.handler/app}
:uberjar-name "server.jar"
:profiles {:dev [:project/dev :profiles/dev]
:project/dev {:dependencies [[javax.servlet/javax.servlet-api "3.1.0"]
[cheshire "5.7.1"]
[ring/ring-mock "0.3.0"]
[com.datomic/clj-client "0.8.606" :exclusions [org.eclipse.jetty/jetty-client
org.eclipse.jetty/jetty-http
org.eclipse.jetty/jetty-util]]]
:plugins [[lein-ring "0.12.0"]]}
:profiles/dev {}})
seems to workIs there standard way to model hierarchical keywords? I'm thinking along the lines of: {:type my-type :item some-entity}
, where my-type
can be derived as per clojure.core/derive. The use case is to query all entities that have a sub-type.
thanks @robert-stuttaford , reading
basically, though, Datomic’s data model is so flexible, you can do what you describe quite comfortably
there was a talk given at 2013 Conj about this but i can’t find it
found it! https://www.youtube.com/watch?v=sQCoTu5v1Mo&list=PLZdCLR02grLpFFB54kq3FU5A0_C94l2WF&index=8
oh, heh
don’t think i’ve considered that before. generally speaking, i find it’s better to be explicit about what you’re asking for. there’s a running joke (at least in the parts of the Clojure community i subscribe to) that there’s no good use for derive
yet
context: I'm modelling interactions between two or more biological entities, which can have an ontological type
In pure clojure, using clojure.core/derive would work as per https://clojure.org/reference/multimethods
this is interesting 🙂
my gut says that derive shenanigans probably won’t work, because attrs are actually just db/idents that resolve to integer ids for the schema that they represent
I'll have to think on this some more, perhaps there's an alternate way to achieve the same thing: datalog query for: find all entities who's type t
matches (ancestor t)
or (child t)
(made up notation)
you could model these relationships explicitly, and write Datalog rules that encompass these lookups
and then use those wherever
https://github.com/Datomic/mbrainz-sample has nice examples of rules and even recursive rules
I could do it with string prefix matching, since the (namespaced) keywords will follow the same pattern. e.g:
:interaction.type.genetic/supressing
:interaction.type.genetic.supresssing/sub
efficiency all depends on how often you do it and how much data you do it on
anyhow, thanks for sounding me out @robert-stuttaford 🙂
Hi. Does anyone have any ideea what version of ring is compatible with [com.datomic/clj-client “0.8.606”]?
I get some conflict in jetty dependency. datomic works with 9.2.21.v20170120 but ring does not
Hello! I want to use docker-compose for docker with postgres storage and guess what? This isn’t working 😃
My steps:
1. dockerfile with postgres
2. dockerfile with datomic-transcator, which depends on 1
3. dockerfile with datomic-peer, which depends on 2
4. dockerfile with datomic-console
This is my docker-compose.yml
, 2 first steps
version: "2"
services:
db:
build:
context: ./postgres
dockerfile: Dockerfile
environment:
- POSTGRES_USER=datomic
- POSTGRES_PASSWORD=datomic
- POSTGRES_DB=datomic
ports:
- "5432:5432"
datomic-transactor:
build:
context: ./datomic-transactor
dockerfile: Dockerfile
ports:
- "4336:4336"
- "4335:4335"
- "4334:4334"
volumes:
- "/data"
- "/log"
depends_on:
- db
In step 1 I add sql-snippets from bin/sql
to image and execute it
In step 2, in config/sql.templates
I add this
protocol=sql
host=0.0.0.0 (???)
port=4334
alt-host=datomic-transactor
license-key=...
sql-url=jdbc: (db, not localhost!!, see docker-compose, where service name is db and this is default name for network)
sql-user=datomic
sql-password=datomic
When I execute docker-compose build
, this happening
Starting datomic:sql://<DB-NAME>?jdbc:, you may need to change the user and password parameters to work with your jdbc driver ...
System started datomic:sql://<DB-NAME>?jdbc:, you may need to change the user and password parameters to work with your jdbc driver
Critical failure, cannot continue: Lifecycle thread failed
java.util.concurrent.ExecutionException: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
When I go to container with postgres, everything work fine, I can execute psql -h localhost -d datomic -U datomic
I search all across github, but nobody share solution =( All work with dev properties
can you connect to the postgresql container from outside the doctor container? could the postgresql user restrict permissions by ip?
yes, I can!
Nope, my build fails
And container doesn’t creates
This is really a docker question. I don't know why the transactor container can't connect to the postgres container. My advice is only general: simplify the problem. Verify that a simple container (no transactor) can connect, work from there
Now I can’t run just datomic with postgres storage local, not in Docker
My steps — launch bin/transctor
with sql properties, then bin/repl
or bin/shell
, where I define db-uri
datomic % uri = "datomic:"
datomic % Peer.createDatabase(uri);
/ Error: // Uncaught Exception: bsh.TargetError: Method Invocation Peer.createDatabase : at Line: 2 : in file: <unknown file> : Peer .createDatabase ( uri )
Target exception: java.util.concurrent.ExecutionException: org.postgresql.util.PSQLException:
Yes, database, which I want to create is “demos” I try your approach, still same error
the connection uri =
I would expect on the peer for a db named demos, given your transactor startup, is datomic:
you may still get an error about not being able to connect to the transactor, but not a postgresql connection error
no, this is psql error
// Error: // Uncaught Exception: bsh.TargetError: Method Invocation Peer.createDatabase : at Line: 2 : in file: <unknown file> : Peer .createDatabase ( uri )
Target exception: java.util.concurrent.ExecutionException: org.postgresql.util.PSQLException: The connection attempt failed.
java.util.concurrent.ExecutionException: org.postgresql.util.PSQLException: The connection attempt failed.
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at clojure.core$deref_future.invokeStatic(core.clj:2290)
at clojure.core$future_call$reify__9377.deref(core.clj:6849)
at clojure.core$deref.invokeStatic(core.clj:2310)
at clojure.core$deref.invoke(core.clj:2296)
Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:233)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:144)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:410)
at org.postgresql.Driver.connect(Driver.java:280)