我正在开发一个使用apachehbase作为数据存储的应用程序。我在一些常见的hbase操作上编写了一个clojure Package 器,
https://github.com/mobiusinversion/hbase
把它推到了clojars。
https://clojars.org/hbase
在hbase Package 器中,我导入bytes类:
(ns hbase.table
(:gen-class)
(:refer-clojure :exclude [get])
(:import [clojure.lang PersistentVector PersistentArrayMap]
[org.apache.hadoop.hbase.util Bytes]
[org.apache.hadoop.hbase.client Put Get HTable Scan]))
然后在另一个名为“wtf”的项目中,我将 Package 器声明为一个依赖项,这很好,它只是将jar从clojar中拉下来。
MacBook-Pro-2:wtf $ lein do clean, deps
... blah blah
Retrieving org/mortbay/jetty/jsp-2.1/6.1.14/jsp-2.1-6.1.14.jar from central
Retrieving ant/ant/1.6.5/ant-1.6.5.jar from central
Retrieving commons-el/commons-el/1.0/commons-el-1.0.jar from central
Retrieving net/java/dev/jets3t/jets3t/0.6.1/jets3t-0.6.1.jar from central
Retrieving hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.jar from central
Retrieving oro/oro/2.0.8/oro-2.0.8.jar from central
Retrieving org/eclipse/jdt/core/3.1.1/core-3.1.1.jar from central
Retrieving org/codehaus/jackson/jackson-mapper-asl/1.8.8/jackson-mapper-asl-1.8.8.jar from central
Retrieving hbase/hbase/0.1.1/hbase-0.1.1.jar from clojars
MacBook-Pro-2:wtf $
但是,在新项目中找不到bytes类(以及所有其他hadoop类):
$ lein repl
nREPL server started on port 58693
REPL-y 0.1.10
Clojure 1.5.1
Exit: Control+D or (exit) or (quit)
Commands: (user/help)
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
(user/sourcery function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
(user/clojuredocs name-here)
(user/clojuredocs "ns-here" "name-here")
user=> (use 'hbase.schema)
ClassNotFoundException org.apache.hadoop.hbase.HTableDescriptor java.net.URLClassLoader$1.run (URLClassLoader.java:202)
user=> (use 'hbase.config)
ClassNotFoundException org.apache.hadoop.hbase.HBaseConfiguration java.net.URLClassLoader$1.run (URLClassLoader.java:202)
user=> (use 'hbase.table)
ClassNotFoundException org.apache.hadoop.hbase.util.Bytes java.net.URLClassLoader$1.run (URLClassLoader.java:202)
user=>
我不知道为什么hadoop类不是作为依赖项被leiningen拉入,就是打包成clojars部署的一部分。如何使这些类可见???
1条答案
按热度按时间nr9pn0ug1#
结果发现,这与使用限定符声明依赖项的顺序有关:
这没有注册hbase依赖项
但是,这会: