1

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

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

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

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

datastore = DataStoreFactory.getDataStore(long.class,UserDetails.class,new Configuration());

我在上面的行中遇到以下异常:

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

有什么我遗漏或不知道的吗?
任何帮助或建议表示赞赏。

4

1 回答 1

0

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

这个问题来自几个月前,但如果其他人有同样的问题,也许这会有所帮助。

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

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

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

于 2013-05-13T11:15:49.187 回答