我正在建立一个使用Gora-hbase作为后端的项目。
    Hbase已启动并正在运行。我没有使用maven或ivy。

另外我在/conf/gora.properties中指定了以下内容:


  gora.datastore.default = org.apache.gora.hbase.store.HBaseStore
          gora.datastore.autocreateschema = true


在我的代码中,我正在使用以下代码来启动数据存储区:


  数据存储=
  DataStoreFactory.getDataStore(long.class,UserDetails.class,新
  组态());


我在上一行收到以下异常:

13/02/04 23:02:26 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x13ca8d9ecac000c, negotiated timeout = 40000
org.apache.gora.util.GoraException: java.lang.RuntimeException: java.net.MalformedURLException
    at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:167)
    at org.apache.gora.store.DataStoreFactory.getDataStore(DataStoreFactory.java:278)
    at com.psl.gora.java.model.TestClass.init(TestClass.java:34)
    at com.psl.gora.java.model.TestClass.<init>(TestClass.java:23)
    at com.psl.gora.java.model.TestClass.main(TestClass.java:47)
Caused by: java.lang.RuntimeException: java.net.MalformedURLException
    at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:125)
    at org.apache.gora.store.DataStoreFactory.initializeDataStore(DataStoreFactory.java:102)
    at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:161)
    ... 4 more
Caused by: java.net.MalformedURLException
    at java.net.URL.<init>(URL.java:617)
    at java.net.URL.<init>(URL.java:480)
    at java.net.URL.<init>(URL.java:429)
    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)
    at org.apache.gora.hbase.store.HBaseStore.readMapping(HBaseStore.java:524)
    at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:111)
    ... 6 more
Caused by: java.lang.NullPointerException
    at java.net.URL.<init>(URL.java:522)
    ... 19 more


我有什么想念的东西吗?
任何帮助或建议表示赞赏。

最佳答案

显示此堆栈跟踪时,可能是因为缺少gora-hbase-mapping.xml

这个问题是几个月前提出的,但是如果其他人也遇到同样的问题,也许会有所帮助。

HBaseStore:524被称为builder.build(null),结果类似于http://www.eclipse.org/forums/index.php/t/262714/

----其他可能性----

尝试作为键类String.class并检查其是否有效。 (只是检查...)

10-08 09:10