clojurewerkz / cassaforte

Modern, high-level Clojure driver (client) for Cassandra build around CQL 3
http://clojurecassandra.info
123 stars 52 forks source link

Fail to use clojurewerkz.cassaforte.query #116

Open tzach opened 9 years ago

tzach commented 9 years ago

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"]
                 ])
michaelklishin commented 9 years ago

@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 commented 9 years ago

@ifesdjeen is this unfinished or an intentional API change?

ifesdjeen commented 9 years ago

@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 commented 9 years ago

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

codygman commented 8 years ago

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}})
ifesdjeen commented 8 years ago

@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.