Я подключаюсь к удаленной базе данных postgres (версия 9.0), используя hibernate.я получаю следующую ошибку
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]
это мой код
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;
try {
transaction = session.beginTransaction();
Failreport sobj=new Failreport();
sobj.setDestination(destination);
sobj.setFailreason(failreason);
sobj.setMessage(message);
sobj.setSmsc(smsc);
sobj.setSmsid(smsid);
sobj.setSource(source);
sobj.setStatus(status);
sobj.setTimedate(timedate);
session.save(sobj);
transaction.commit();
} catch (HibernateException e) {
transaction.rollback();
e.printStackTrace();
} finally {
session.close();
}
}
Hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="MyFactory">
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.password">xxxx</property>
<property name="hibernate.connection.url">jdbc:postgresql://xx.xx.xx.xx:5432/smslog</property>
<property name="hibernate.connection.username">xxxxx</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.validator.apply_to_ddl">false</property>
<property name="hibernate.validator.autoregister_listeners">false</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.jdbc.batch_size">0</property>
<mapping resource="com/java/model/Kannel.hbm.xml"/>
<mapping resource="com/java/model/Smsc.hbm.xml"/>
<mapping resource="com/java/model/Dlr.hbm.xml"/>
<mapping resource="com/java/model/Routesmsc.hbm.xml"/>
<mapping resource="com/java/model/Simplereport.hbm.xml"/>
<mapping resource="com/java/model/Failreport.hbm.xml"/>
</session-factory>
</hibernate-configuration>