java.io.FileNotFoundException:找不到类路径上的clojure / spec / alpha__init.class或clojure / spec / alpha.clj

时间:2018-02-06 13:31:07

标签: clojure

我试图了解Clojure规范。在设置clojure项目时,我遇到了错误,同时需要clojure.spec.alpha:

Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath., compiling:
at clojure.lang.Compiler.load(Compiler.java:7391)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$script_opt.invokeStatic(main.clj:335)
at clojure.main$script_opt.invoke(main.clj:330)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:379)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)

我的project.clj:

(defproject testing "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.9.0"]
                 [org.clojure/spec.alpha "0.1.143"]
                 [org.clojure/core.specs.alpha "0.1.10"]])

和core.clj:

(ns testing.core
  (:require [clojure.spec.alpha :as s]))

(defn foo
  "I don't do a whole lot."
  [x]
  (println x "Hello, World!"))

如果有人可以帮助我,我将感激不尽。

4 个答案:

答案 0 :(得分:1)

我做了lein clean并开始工作

答案 1 :(得分:1)

我遇到了同样的错误,我不知道clojure但是必须修复使用 { "Version": "2008-10-17", "Id": "permissionTohttps", "Statement": [ { "Sid": "AddPerm", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::xxxxxxxxx:root" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::test-2018/test/*", "Condition": { "Bool": { "aws:SecureTransport": "true" } } } ] } 测试Kafka Storm的一些NoClassDefFoundError例外情况。

第一个例外是:org.apache.storm.kafka.KafkaSpout

我通过在类路径中包含clojure-1.9.0.jar来解决这个问题。

接下来,这个例外:

NoClassDefFoundError: clojure/lang/IFn

后来意识到他们还有另一个罐spec.alpha-0.1.143.jar

希望这有助于其他人!

答案 2 :(得分:1)

对我有用的是将test.check库作为对我的类路径的依赖项添加

答案 3 :(得分:0)

对于那些在1.9上遇到此问题的人,请参见https://groups.google.com/forum/#!msg/clojure/-ovhQXtzhgw/XBm_rfcICgAJ

对于1.8版本,您只需运行.m2中的java -jar clojure-1.8.0.jar,RELP即刻启动。对于1.9,情况不再如此。您需要默认情况下.m2中可能没有的其他库。

但是,如果您基于official guide安装Clojure,则会拥有它们。

相关问题