Fork me on GitHub
#beginners
<
2016-09-12
>
danielres12:09:23

hello Clojurians, Despite lots of enthusiasm, I've been struggling for days in my very first steps with Clojure. Problem is I've downloaded the lein script, chmoded it as executable, but when I run lein repl I got an error

Could not transfer artifact org.clojure:tools.nrepl:pom:0.2.12 from/to central (): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Could not transfer artifact clojure-complete:clojure-complete:pom:0.2.4 from/to central (): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Could not transfer artifact org.clojure:clojure:pom:1.8.0 from/to central (): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.
Exception in thread "Thread-3" clojure.lang.ExceptionInfo: Could not resolve dependencies {:suppress-msg true, :exit-code 1}
When I visit https://repo1.maven.org/maven2 with my browser (Chrome), All is fine. So I can access the repo from my laptop, but that lein can't, for whatever reason. I've researched solutions online, tried completely purging java from my system, I've also tried different java implementations without success. I'm under Ubuntu 15.04. I'd really appreciate help and suggestions with this. Thanks !!

danielres13:09:17

thank you, I finally found the fix here: http://stackoverflow.com/questions/33439905/is-the-cacerts-file-missing-in-ubuntu-15-10-and-openjdk-8-jdk The solution:

$ sudo dpkg --purge --force-depends ca-certificates-java
$ sudo apt-get install ca-certificates-java

olegakbarov13:09:35

what’s the best data structure for sortable list in clojure? assuming i need to swap the order of items? (item is map)

olegakbarov13:09:12

Vector seems like a bad option because of tedions subvec

olegakbarov13:09:38

though map with id’s seems like a hassle to iterate

Alex Miller (Clojure team)13:09:58

sorted-set might be useful, depends on what you’re doing before and after with it

credulous19:09:43

Hi, I’m ready to deploy a web page I’ve been developing locally, but I’m not sure how to proceed.

credulous19:09:58

“lein run” works fine. But when I try lein uberjar I get

credulous19:09:41

sorry. lein uberjar works fine. It creates target/cavalry-stats-0.1.0-SNAPSHOT-standalone.jar. But when I try java -jar /target/cavalry-stats-0.1.0-SNAPSHOT-standalone.jar I get an error:

Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Var
       	at cavalry_stats.core.<clinit>(Unknown Source)
Caused by: java.lang.ClassNotFoundException: clojure.lang.Var
       	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
       	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
       	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
       	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

credulous19:09:28

My main file ns:

(ns cavalry-stats.core
   (:require [ring.adapter.jetty :as jetty]
             [compojure.core :as compojure]
             [compojure.route :as route]
             [ring.util.http-response :as response]
             [ring.middleware.reload :refer [wrap-reload]]
             [ring.middleware.format :refer [wrap-restful-format]]
             [cavalry-stats.data :as data]
             [cavalry-stats.views.layout :as layout]
             [cavalry-stats.views.contents :as contents]
             [cronj.core :refer :all])
   (:gen-class)
   )

credulous19:09:44

project.clj:

credulous19:09:47

(defproject cavalry-stats "0.1.0-SNAPSHOT"
   :description "FIXME: write description"
   :url ""
   :license {:name "Eclipse Public License"
             :url ""}
   :dependencies [[org.clojure/clojure "1.8.0"]
                  [com.novemberain/monger "3.0.2"]
                  [cheshire "5.6.3"]
                  [clj-time "0.12.0"]
                  [ring "1.4.0"]
                  [metosin/ring-http-response "0.6.5"]
                  [ring-middleware-format "0.7.0"]
                  [compojure "1.4.0"]
                  [im.chit/cronj "1.4.4"]
                  [hiccup "1.0.5"]
                  ]
   :main cavalry-stats.core
   )

credulous19:09:31

and the main function in cavalry-stats.core:

credulous19:09:33

(defn -main []
   (data/refresh-data!)
   (start! cj)
   (jetty/run-jetty
     (-> #'handler wrap-nocache wrap-reload wrap-formats)
     {:port 3000
      :join? false}))

seancorfield21:09:48

That sounds like lein uberjar is not including Clojure itself in your JAR file...

seancorfield21:09:33

Perhaps you could put the code up on GitHub so we can try to repro / debug?