Now I am having fun with these recipes. I like that I can have embedded css in my render functions. Some might say that it should be separated so that a non-developer could mess with it, but in a full stack development mode this way seems better.
Is there a recipe for using datomic
thereโs untangled-todomvc. it uses untangledโs own layer on top of datomic. personally i just roll an ad hoc component like so https://github.com/swannodette/om-next-demo/blob/master/todomvc/src/clj/todomvc/datomic.clj
hello, I'm trying to compile an untangled app for production, but I'm getting this error:
you guys have any idea what this is about?
when I try to compile using the lein uberjar
I get a different error message:
Hm. Not sure why it is looking for that interface. @adambros made those changes recently to server. If you're not needing the latest server, then I'd drop back on the version. We have not had time to debug :advanced
compilation either, so you try :whitespace
or :simple
optimizations instead.
@tony.kay actually this is using simple, I didn't changed the template, so I'm trying to get that first before trying advanced
but it builds in figwheel?
yes
latest version of cljsbuild?
[lein-cljsbuild "1.1.4"]
try 1.1.5 (clean and rebuild)
this is on untangled-template?
also, did you add deps? If so, have you analyzed and corrected any problems in lein deps :tree
?
the default template compiles for me in production mode
just tried the update, but no success...
it's from the template and I have added a few dependencies, I should being trying to compile from the start, but this is first time I try, so, kind stuck here...
lein deps :tree
is your friend, for sure
I'm using latest cljs and clojure ([org.clojure/clojure "1.9.0-alpha14"] [org.clojure/clojurescript "1.9.293"]), the bad part is that I'm actually using clojure.spec a lot, I can't try rolling back
ok, let me check what the deps tell me
are you using any cljc files?
yes
Ah, you might have clj only stuff not annotated that way
not sure why it would work in figwheel, but never know
the untangled/server/core/APIHandler
bit should not be showing up
you might have a require that is hitting both sides
my cljc files are pretty simple, mostly they used shared stuff, the only occasions it doesn't are for integer coercion and string trimming (which uses google closure on cljs)
com.google.common
...same thing
I tried to look for unwanted things, but not much there
both of those things are Java/Clojure things, not cljs
maybe you meant goog.string
anyhow, those are my best guesses based on your errors
this is the file, I don't think it's about it:
(ns remember.input-tags
(:require [clojure.string :as str]
#?(:cljs [goog.string :as gstr])))
(defn str-trim [s]
#?(:clj (.trim s)
:cljs (gstr/trim s)))
(def tag-regex #"\[(.+?)]")
(def tag-regex-with-empty #"\[(.*?)]")
(defn process [input]
(let [input (or input "")]
{:text (-> input
(str/replace tag-regex-with-empty "")
(str-trim))
:tags (into #{} (map second) (re-seq tag-regex input))}))
on the dependencies side, I added friend
, which had some problems with ring-core
because it was pointing to an old version incompatible with clj 1.9 (`ns` was incorrect)
just the error message is weird, why it's failing on Java stuff during cljs compilation?
agreed it is weird
what JVM version?
JDK, that is
Is your IDE perhaps using one, and the command-line another?
maybe you're hitting an old version of the JVM at the command line?
Wilkers-MacBook-Pro:datomic-pro-0.9.5530 wilkerlucio$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
ok, I tried changing the compilation from :simple
to :none
and now it worked
@tony.kay now let's see how the uberjar goes ๐
so, seems to be working with none, thanks for the help Tony
weird
but none does not generate a single js file
you at least want :whitespace
Are you guys aware that one month ago Datomic Pro became free to use with unlimited clients (no support though)? I am asking because I want to use it, and I'm wondering how hard it would be to fork untangled-todomvc and make it use Datomic Pro.
@tony.kay just tried changing to whitespace, and errors got back
@fragamus I was not aware. Should be nothing more than a dependency change, assuming you don't have to apply for a license file
@wilkerlucio Hm. I'd be interested if you find out why. The template works, so it is something you added. I would strongly suspect the cljc stuff since it is complaining about Java stuff
@tony.kay I'll find some time to investigate it deeper, try to debug and see if I can pinpoint whats going on, I'll let you know
thanks
@fragamus Staying with free version we're on. Sounds like you still need a license file to make Starter work
I want people to be able to try out the example code without going through extra hoops
hopefully they'll continue to provide datomic-free. If not, then we'll look at the options
Of course, but my aim is to morph untangled-todomvc into an app of my own, and in order to scale, I'll need something like this Datomic Pro.
@tony.kay I tried to run the compiled uberjar, and the error from ApiHandler showed up again
Wilkers-MacBook-Pro:remember2 wilkerlucio$ PORT=8080 java -Dconfig=config/prod.edn -jar target/remember.jar
Exception in thread "main" java.lang.NoClassDefFoundError: untangled/server/core/APIHandler (wrong name: untangled/server/core/ApiHandler)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at clojure.lang.RT.classForName(RT.java:2183)
at clojure.lang.RT.classForName(RT.java:2192)
at untangled.server.core__init.__init0(Unknown Source)
at untangled.server.core__init.<clinit>(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at clojure.lang.RT.classForName(RT.java:2183)
at clojure.lang.RT.classForName(RT.java:2192)
at clojure.lang.RT.loadClassForName(RT.java:2211)
at clojure.lang.RT.load(RT.java:445)
at clojure.lang.RT.load(RT.java:421)
at clojure.core$load$fn__7846.invoke(core.clj:6008)
at clojure.core$load.invokeStatic(core.clj:6007)
at clojure.core$load.doInvoke(core.clj:5991)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invokeStatic(core.clj:5812)
at clojure.core$load_one.invoke(core.clj:5807)
at clojure.core$load_lib$fn__7791.invoke(core.clj:5852)
at clojure.core$load_lib.invokeStatic(core.clj:5851)
at clojure.core$load_lib.doInvoke(core.clj:5832)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invokeStatic(core.clj:659)
at clojure.core$load_libs.invokeStatic(core.clj:5889)
at clojure.core$load_libs.doInvoke(core.clj:5873)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:659)
at clojure.core$require.invokeStatic(core.clj:5911)
at clojure.core$require.doInvoke(core.clj:5911)
at clojure.lang.RestFn.invoke(RestFn.java:482)
at remember.core$loading__7732__auto____16713.invoke(core.clj:1)
at remember.core__init.load(Unknown Source)
at remember.core__init.<clinit>(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at clojure.lang.RT.classForName(RT.java:2183)
at clojure.lang.RT.classForName(RT.java:2192)
at clojure.lang.RT.loadClassForName(RT.java:2211)
at clojure.lang.RT.load(RT.java:445)
at clojure.lang.RT.load(RT.java:421)
at clojure.core$load$fn__7846.invoke(core.clj:6008)
at clojure.core$load.invokeStatic(core.clj:6007)
at clojure.core$load.doInvoke(core.clj:5991)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:379)
at clojure.lang.Util.loadWithClass(Util.java:250)
at remember.core.<clinit>(Unknown Source)
turn on verbose compile option for cljs
do you think the fact you have the protocol APIHandler
and the class ApiHandler
could be a problem?
perhaps you can at least see which file it is hitting
I didn't write APIHandler
and have not reviewed it
check this: https://github.com/untangled-web/untangled-server/blob/master/src/untangled/server/core.clj#L151-L204
I just have a hunch that the names might be clashing
the compiled output only has core$api_handler.class
where would the clash be coming from?
where is the class?
I see the protocol
there is a protocol named APIHandler
and a defrecord
named ApiHandler
(line 181)
the difference on name is only on the letter case
Ah, I was looking at develop (where it is changed)
stand by
just pushed 0.7.0-SNAPSHOT to clojars. Try that
ok, thanks
of server, but I assume you knew that
can you remind me how I force the snapshot update?
lein deps -U
I think?
oh, just lein -U any-task
is the new way
@tony.kay jar running! ๐
sweet. So, the current master is busted, but develop is not. I should cut a release probably
actually, the current master was an internal release only, so you were already using 0.7.0-SNAPSHOT I take it
and it was busted. So, guess we're ok
your optimizations should work now on cljsbuild as well
no, compilation with optimizations still failing, but I'm starting to suspect that the problem might be about my user.clj
, I see some logs messages indicating it's being loaded, and I don't expected it too (because it loads some code to easy querying my system, but I don't expected it to be running during cljs compilations)
http://blog.datomic.com/2016/11/datomic-update-client-api-unlimited.html
@tony.kay hey, I found more weirdness here, hehehe, if I just remove datomic dependency the compilation with :whitespace starts working again
I tried switching datomic versions, but any of then are failing (free or pro)
seems that the guava
dependency is incompatible between datomic and cljs 1.9.293
@tony.kay all compilations working again! solution: add :exclusions [com.google.guava/guava]
to datomic
dependency
even :advanced
!! ๐
so happy that advanced worked with no extra change ๐
This is timely info - I've been updating libraries today - cljs was going to be my last one - might be a problem from the sounds of it. Glad you found the source of the error @wilkerlucio ๐
cool, hopefully it will be easier for you, please let us know if you bump in some problem ๐
@wilkerlucio Yes, I did suspect that kind of dep conflict. That has very frequently been the source of problems for me.
just for my own edification: were you getting warnings from lein deps :tree
around that?
kind of, it pointed that, but in the wrong direction
it asked to exclude it on the clojurescript side
but that didn't worked, excluding on datomic did
I'm thinking that an alternative would be to move datomic dependency into a different profile, and exclude that profile while compiling cljs
because I'm afraid excluding it from datomic might cause some problem in some situation
so, the recommendataions are typically crap...it's the fact that it makes one that is helpful
The exclusions route is so-so, as it just causes some other inherited dep to take precedence. If you nail the top-level to a version it is more explicit.
but then you're saying you depend directly on the resource
so, hard balance to strike. I have often chosen the route of declaring an explicit dependency rather than an exclusion, since the exclusions end up needing to be peppered about like the swedish chef got hold of your project file.
had you people deployed datomic to heroku? I'm trying to follow this tutorial: https://elements.heroku.com/buildpacks/opengrail/heroku-buildpack-datomic
I'm just not sure what my datomic connection url should look like
should I point to localhost?
not us
Since this is a buildpack for a transactor, I'm guessing the idea is to point another Heroku app's datomic client to whatever your heroku appname is - something like datomic:<dev://freezing-rain.herokuapp.com:80/test>
?
But we've always had Datomic in AWS and it's been a while since we moved off Heroku.
humm, thanks @therabidbanana, I was trying to use both on the same app, I'll try to make a different one, thanks
how hard is it to deploy untangled-todomvc on heroku? I am going through the arduous process of morphing their starter app into untangled-todomvc. I tried to deploy untangled-todomvc but it lacked that certain something with which I am unfamiliar.