当前位置 : 主页 > 编程语言 > java >

jsp – 尝试在活动池中借用使用cassandra的hector

来源:互联网 收集:自由互联 发布时间:2021-06-25
当我尝试运行hector wiki提供的 SchemaManipulation示例时,服务器第一次运行时服务器启动时一切正常,但是在第二次运行后发生错误(下面的完整堆栈跟踪) 我试图使用hector 1.0.2和Glassfish 3.1连接
当我尝试运行hector wiki提供的 SchemaManipulation示例时,服务器第一次运行时服务器启动时一切正常,但是在第二次运行后发生错误(下面的完整堆栈跟踪)

我试图使用hector 1.0.2和Glassfish 3.1连接到cassandra 1.0.7.
我正在使用Netbeans 7.1.

已导入的自定义JARs

首次运行(成功):

SEVERE: log4j:WARN No appenders could be found for logger (me.prettyprint.cassandra.connection.CassandraHostRetryService).
SEVERE: log4j:WARN Please initialize the log4j system properly.
INFO: Dropped key space
INFO: Name: WOO
INFO: RF: 1
INFO: strategy class: org.apache.cassandra.locator.SimpleStrategy
INFO:   CF Type: STANDARD
INFO:   CF Name: DynamicCf
INFO:   CF Metadata: [ThriftColumnDef[name=java.nio.HeapByteBuffer[pos=8330 lim=8339 cap=9252],validationClass=org.apache.cassandra.db.marshal.LongType,indexType=KEYS,indexName=birthdate_idx]]
INFO:   CF Type: SUPER
INFO:   CF Name: SuperCf
INFO:   CF Metadata: []

完整堆栈跟踪错误:

SEVERE: me.prettyprint.hector.api.exceptions.HInactivePoolException: Attempt to borrow on in-active pool: <ConcurrentCassandraClientPoolByHost>:{localhost(127.0.0.1):9160}
    at me.prettyprint.cassandra.connection.ConcurrentHClientPool.borrowClient(ConcurrentHClientPool.java:69)
    at me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:235)
    at me.prettyprint.cassandra.service.AbstractCluster.describeKeyspace(AbstractCluster.java:199)
    at net.zanity.live.SchemaManipulation.main(SchemaManipulation.java:40)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:68)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)

SEVERE:     at me.prettyprint.cassandra.connection.ConcurrentHClientPool.borrowClient(ConcurrentHClientPool.java:69)
SEVERE:     at me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:235)
SEVERE:     at me.prettyprint.cassandra.service.AbstractCluster.describeKeyspace(AbstractCluster.java:199)
SEVERE:     at net.zanity.live.SchemaManipulation.main(SchemaManipulation.java:40)
SEVERE:     at org.apache.jsp.index_jsp._jspService(index_jsp.java:68)
SEVERE:     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
SEVERE:     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
SEVERE:     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
SEVERE:     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
SEVERE:     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
SEVERE:     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
SEVERE:     at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
SEVERE:     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
SEVERE:     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
SEVERE:     at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
SEVERE:     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
SEVERE:     at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
SEVERE:     at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
SEVERE:     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
SEVERE:     at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
SEVERE:     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
SEVERE:     at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
SEVERE:     at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
SEVERE:     at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
SEVERE:     at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
SEVERE:     at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
SEVERE:     at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
SEVERE:     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
SEVERE:     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
SEVERE:     at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
SEVERE:     at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
SEVERE:     at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
SEVERE:     at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
SEVERE:     at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
SEVERE:     at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
SEVERE:     at java.lang.Thread.run(Thread.java:722)

jsp页面:

<%@page contentType="text/html" import="net.zanity.live.*;" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1><% out.println("AAAA"); %></h1>
        <%// SchemaManipulation.main(new String[0]); %>
        <%
        /*
            InsertSingleColumn ins = new InsertSingleColumn();
            String temp = ins.Insert();
            out.print(temp);*/
        SchemaManipulation.main(new String[0]);
        %>
        <h1><% out.println("AAAA2 :D"); %></h1>
    </body>
</html>
由于使用了SchemaManipulation示例并且缺乏Cassandra经验,我没有意识到该示例在完成执行后会关闭集群.

这会关闭开放池并杀死conndection,对于其他任何与此相关的人,只是在课程结束时不要关闭集群

//remove this as it kills the cluster.
cluster.getConnectionManager().shutdown();
网友评论