cassaforte icon indicating copy to clipboard operation
cassaforte copied to clipboard

Fail to use clojurewerkz.cassaforte.query

Open tzach opened this issue 10 years ago • 6 comments

I'm following the getting started guide clojurewerkz.cassaforte.client/connect works fine, but when I try to use

(ns test-cassansra.core
  (:require [clojurewerkz.cassaforte.client :as cc]
            [clojurewerkz.cassaforte.cql    :as cql]
            [clojurewerkz.cassaforte.query  :refer :all]))

I get

clojure.lang.Compiler$CompilerException: java.lang.NoClassDefFoundError: Could not initialize class clojurewerkz.cassaforte.query__init, compiling:(clojurewerkz/cassaforte/cql.clj:1:1)

Looks like query lib is missing.

My project file:

(defproject test-cassansra "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [clojurewerkz/cassaforte "3.0.0-alpha1"]
                 ])

tzach avatar Nov 07 '15 13:11 tzach

@tzach please use mailing list for questions. You are trying to use an alpha version from master. The docs cover 2.x and pretty explicitly say so.

michaelklishin avatar Nov 07 '15 13:11 michaelklishin

@ifesdjeen is this unfinished or an intentional API change?

michaelklishin avatar Nov 07 '15 13:11 michaelklishin

@michaelklishin it is finished, and I was pretty sure query.clj is still there :/ https://github.com/clojurewerkz/cassaforte/blob/master/src/clojure/clojurewerkz/cassaforte/query.clj

ifesdjeen avatar Nov 08 '15 17:11 ifesdjeen

might be an artifact upload problem, i'm investigating the problem right now

ifesdjeen avatar Nov 08 '15 17:11 ifesdjeen

I'm currently affected by this issue. My project.clj:

(defproject apollo "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [
                 [org.clojure/clojure "1.8.0"]
                 [seesaw "1.4.2" :exclusions [org.clojure/clojure]]
                 [clojurewerkz/cassaforte "3.0.0-alpha1"]
                 ]
  :main ^:skip-aot apollo.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

codygman avatar Feb 17 '16 02:02 codygman

@codygman i've just tried that once again, it somehow works for me.. could you please try running

rm -fr ~/.m2/repository/clojurewerkz/cassaforte/3.0.0-alpha1

it might be that the artefact got cached or something similar happened... I've tried with / without AOT, with 1.8 and 1.6 Clojure, works in all cases.

project.clj:

(defproject cassafortest "0.1.0-SNAPSHOT"
  :main cassafortest.core
  :aot [cassafortest.core]
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [clojurewerkz/cassaforte "3.0.0-alpha1"]])

core.clj

(ns cassafortest.core
  (:require [clojurewerkz.cassaforte.client :as cc]
            [clojurewerkz.cassaforte.cql    :as cql]
            [clojurewerkz.cassaforte.query  :refer :all]))


(defn foo
  []
  (cc/connect ["hackercloud"]))

(defn -main [& string] (println (foo )))

Output:

Compiling cassafortest.core
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
WARNING: update already refers to: #'clojure.core/update in namespace: cassafortest.core, being replaced by: #'clojurewerkz.cassaforte.query/update
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
WARNING: update already refers to: #'clojure.core/update in namespace: cassafortest.core, being replaced by: #'clojurewerkz.cassaforte.query/update
#object[com.datastax.driver.core.SessionManager 0x2687f956 com.datastax.driver.core.SessionManager@2687f956]

First initialization occurs during the compilation, the second already during the runtime. So all looks correct. Without AOT looks almost same with an exception there's only one init.

ifesdjeen avatar Feb 17 '16 07:02 ifesdjeen