1

我对 Hbase 和 Hadoop 很陌生,尤其是对 java 也很陌生。最近开始研究 Hbase 和 Java。我已经成功安装和配置了 Hadoop 和 Hbase,并且还使用本教程在 hbase 上制作了我的第一个 java 应用程序 http://autofei.wordpress.com/2012/04/02/java-example-code-using-hbase-data-模型操作/

现在,我想使用 servlet 和 Jsp 将 hbase 与 Web 应用程序连接起来。在这方面,我制作了一个 jsp 页面,在其中获取用户输入并将它们传输到 servlet 以将它们插入到我的 HTable 中,但不幸的是我遇到了这个错误:

    `SEVERE:   java.util.NoSuchElementException 
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:897) 
    at java.util.HashMap$KeyIterator.next(HashMap.java:928) 
    at org.apache.hadoop.security.UserGroupInformation.<init>(UserGroupInformation.java:430) 
    at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:452) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.apache.hadoop.hbase.util.Methods.call(Methods.java:37) 
    at org.apache.hadoop.hbase.security.User.call(User.java:590) 
    at org.apache.hadoop.hbase.security.User.callStatic(User.java:580) 
    at org.apache.hadoop.hbase.security.User.access$400(User.java:51) 
    at org.apache.hadoop.hbase.security.User$SecureHadoopUser.<init>(User.java:397) 
    at org.apache.hadoop.hbase.security.User$SecureHadoopUser.<init>(User.java:392) 
    at org.apache.hadoop.hbase.security.User.getCurrent(User.java:140) 
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionKey.<init>(HConnectionManager.java:435) 
    at org.apache.hadoop.hbase.client.HConnectionManager.getConnection(HConnectionManager.java:180) 
    at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155) 
    at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:133) 
    at com.Hbase.Controller.HbaseServlet.addRecord(HbaseServlet.java:89) 
    at com.Hbase.Controller.HbaseServlet.processRequest(HbaseServlet.java:67) 
    at com.Hbase.Controller.HbaseServlet.doPost(HbaseServlet.java:159) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) 
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) 
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) 
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) 
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188) 
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191) 
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168) 
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189) 
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114) 
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838) 
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135) 
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564) 
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544) 
    at java.lang.Thread.run(Thread.java:724) 

我没有做任何特别的事情,只是通过参数将 jps 的值传递给 Servlet,并使用了给定链接中提到的 addRecord 函数。当我通过以下代码创建我的 HTable 实例时,就会出现上述错误: HTable table = new HTable(conf, "scores");

我真的不知道该怎么做,因为我找不到任何将 Hbase 与 Servlet 和 Jsp 一起使用的教程。我请求请指导我如何将 Hbase 与 Servlet 和 Jsp 一起使用,并请指出我在 Web 应用程序中使用 Hbase 的任何教程,因为我必须开发一个完整的 Web 应用程序,这将是我的学位项目。

提前致谢,

问候,

山姆

4

1 回答 1

0

所以,最后我自己弄清楚了为什么我有 java.util.NoSuchElementException 的问题,这只是因为 glassfish 服务器 4.0。当我将我的 glassfish 服务器降级到 3.2 时,它就像一个魅力..

谢谢你。

于 2013-07-16T17:16:33.940 回答