Skip site navigation (1) Skip section navigation (2)

Too many connection already

From: <rishi(dot)kolvekar(at)wwindia(dot)com>
To: <mumbai-pug(at)postgresql(dot)org>
Subject: Too many connection already
Date: 2011-03-08 12:06:28
Message-ID: FD67C3AD5BBC4DE0A87B7E62AFD353DF.MAI@RX618.rapidns.com (view raw or flat)
Thread:
Lists: mumbai-pug
<br><p>Hi guys,
         I am connecting to a remote postgres(version 9.0) database using hibernate. i get following error </p>

<p>2011-03-08 06:48:25,695 ERROR
[org.hibernate.util.JDBCExceptionReporter] (http-69.89.2.245-8080-9)
FATAL: sorry, too many clients already
2011-03-08 06:48:25,695 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/JBOSSINI].[com.java.misc.feedback]]
 (http-69.89.2.245-8080-9) Servlet.service() for servlet
com.java.misc.feedback threw exception: java.lang.NullPointerException
    at com.java.model.HiberEx.InsertsimpleReport(HiberEx.java:95) [:]
    at com.java.misc.feedback.doGet(feedback.java:87) [:]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
[:1.0.0.Final]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[:1.0.0.Final]
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324)
 [:6.0.0.Final]
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
 [:6.0.0.Final]
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
 [:6.0.0.Final]
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 [:6.0.0.Final]
    at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181)
 [:6.0.0.Final]
    at
org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285)
 [:1.1.0.Final]
    at
org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261)
 [:1.1.0.Final]
    at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88)
 [:6.0.0.Final]
    at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100)
 [:6.0.0.Final]
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 [:6.0.0.Final]
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 [:6.0.0.Final]
    at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
 [:6.0.0.Final]
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 [:6.0.0.Final]
    at
org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)
 [:6.0.0.Final]
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
 [:6.0.0.Final]
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
 [:6.0.0.Final]
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)
 [:6.0.0.Final]
    at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
[:6.0.0.Final]
    at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]</p>

<p>this my code</p>

<p>public void InsertfailReport(String destination,
                String source,
                String status,
                String timedate, String smsc,
                String failreason,
                String smsid,
                String message){
                SessionFactory sessionFactory = new
Configuration().configure("com/java/hibernate.cfg.xml").buildSessionFactory();

                Session session = sessionFactory.openSession();
                Transaction transaction = null;</p>

<pre><span class="pln">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try </span><span class="pun">{</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="kwd">transaction</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> session</span><span class="pun">.</span><span class="pln">beginTransaction</span><span class="pun">();</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Failreport sobj</span><span class="pun">=</span><span class="pln">new Failreport</span><span class="pun">();</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sobj</span><span class="pun">.</span><span class="pln">setDestination</span><span class="pun">(</span><span class="pln">destination</span><span class="pun">);</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sobj</span><span class="pun">.</span><span class="pln">setFailreason</span><span class="pun">(</span><span class="pln">failreason</span><span class="pun">);</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sobj</span><span class="pun">.</span><span class="pln">setMessage</span><span class="pun">(</span><span class="pln">message</span><span class="pun">);</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sobj</span><span class="pun">.</span><span class="pln">setSmsc</span><span class="pun">(</span><span class="pln">smsc</span><span class="pun">);</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sobj</span><span class="pun">.</span><span class="pln">setSmsid</span><span class="pun">(</span><span class="pln">smsid</span><span class="pun">);</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sobj</span><span class="pun">.</span><span class="pln">setSource</span><span class="pun">(</span><span class="pln">source</span><span class="pun">);</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sobj</span><span class="pun">.</span><span class="pln">setStatus</span><span class="pun">(</span><span class="pln">status</span><span class="pun">);</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sobj</span><span class="pun">.</span><span class="pln">setTimedate</span><span class="pun">(</span><span class="pln">timedate</span><span class="pun">);</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; session</span><span class="pun">.</span><span class="kwd">save</span><span class="pun">(</span><span class="pln">sobj</span><span class="pun">);</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="kwd">transaction</span><span class="pun">.</span><span class="kwd">commit</span><span class="pun">();</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="pun">}</span><span class="pln"> catch </span><span class="pun">(</span><span class="pln">HibernateException e</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="kwd">transaction</span><span class="pun">.</span><span class="kwd">rollback</span><span class="pun">();</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e</span><span class="pun">.</span><span class="pln">printStackTrace</span><span class="pun">();</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="pun">}</span><span class="pln"> finally </span><span class="pun">{</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; session</span><span class="pun">.</span><span class="kwd">close</span><span class="pun">();</span><span class="pln"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="pun">}</span><span class="pln"><br>&nbsp; &nbsp; </span><span class="pun">}<br><br><br>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>&lt;!DOCTYPE hibernate-configuration PUBLIC<br>		"-//Hibernate/Hibernate Configuration DTD 3.0//EN"<br>		"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;<br>&lt;hibernate-configuration&gt;<br>    &lt;session-factory name="MyFactory"&gt;<br>        &lt;property name="hibernate.connection.driver_class"&gt;org.postgresql.Driver&lt;/property&gt;<br>        &lt;property name="hibernate.connection.password"&gt;xxxx&lt;/property&gt;<br>        &lt;property name="hibernate.connection.url"&gt;jdbc:postgresql://xx.xx.xx.xx:5432/smslog&lt;/property&gt;<br>        &lt;property name="hibernate.connection.username"&gt;xxxxx&lt;/property&gt;<br>        &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQLDialect&lt;/property&gt;<br>    	&lt;property name="hibernate.validator.apply_to_ddl"&gt;false&lt;/property&gt;<br>  		&lt;property name="hibernate.validator.autoregister_listeners"&gt;false&lt;/property&gt;<br>   		&lt;property name="hibernate.show_sql"&gt;true&lt;/property&gt;<br>   		&lt;property name="hibernate.jdbc.batch_size"&gt;0&lt;/property&gt;<br>    	  &lt;mapping resource="com/java/model/Kannel.hbm.xml"/&gt;<br>    	  &lt;mapping resource="com/java/model/Smsc.hbm.xml"/&gt;<br>    	  &lt;mapping resource="com/java/model/Dlr.hbm.xml"/&gt;<br>    	  &lt;mapping resource="com/java/model/Routesmsc.hbm.xml"/&gt;<br>    	  &lt;mapping resource="com/java/model/Simplereport.hbm.xml"/&gt;<br>    	  &lt;mapping resource="com/java/model/Failreport.hbm.xml"/&gt;<br>    &lt;/session-factory&gt;<br>&lt;/hibernate-configuration&gt;<br></span><span class="pln"></span></code></pre>



Attachment: unknown_filename
Description: text/html (9.0 KB)

mumbai-pug by date

Next:From: Sandy Joseph PadalaDate: 2013-05-08 10:29:18
Subject: About Instant PostgreSQL Starter book from Packt
Previous:From: trimurthulu bandaruDate: 2010-09-28 09:03:52
Subject: connection limit exceed

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group