I have a really huge problem, i have random broken pipe error on my webapp, whatever the page is...it is in production! I did'nt have that before i tryed all configuration for the maxidle, maxwait and maxactive properties possible without success...
I am using : MySQL 4.1 Tomcat 5.5 DBCP Hibernate version: 3.0
My datasource is properly configured in \META-INF\context.xml this config works since i tested it with another webapp that dont use hibernate
Here is the code of my hibernate helper class:
private static final SessionFactory sessionFactory;
private static final ThreadLocal threadSession = new ThreadLocal();
private static final ThreadLocal threadTransaction = new ThreadLocal();
//CAN SOMEONE CONFIRM HERE THAT THIS STATIC BLOCK IS CORRECTLY USED WITH A DATASOURCE?
static { try { Configuration cfg = new Configuration(); cfg.configure("mapping/hibernate.cfg.xml"); sessionFactory = cfg.buildSessionFactory(); } catch(Throwable ex) { ex.printStackTrace(); throw new ExceptionInInitializerError(ex); } }
/**
* Return a unique session object
*
*/
public static Session getSession() {
Session session = (Session) threadSession.get();
//Open a new Session, if this thread has none yet
try{
if(session == null){
session = sessionFactory.openSession();
threadSession.set(session);
}
}
catch(HibernateException ex){
ex.getMessage();
}
return session;
}
/**
* Close the session object
*
*/
public static void closeSession(){
Session session = (Session)threadSession.get();
try{
threadSession.set(null);
if(session != null && session.isOpen()){
session.close();
}
}
catch(HibernateException ex){
ex.printStackTrace();
}
}
My 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">
<!-- Generated by MyEclipse Hibernate Tools. --> <hibernate-configuration>
<session-factory>
<property name="myeclipse.connection.profile">MySql</property> <property name="connection.url">jdbc:mysql://localhost/inouk?autoReconnect=true</property> <property name="connection.username">admin</property> <property name="connection.password">pass</property> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.show_sql">false</property> <property name="connection.datasource">java:comp/env/jdbc/InoukDB</property>
<!--### Apache DBCP Connection Pool ###--> <!--connection pool--> <property name="hibernate.dbcp.maxActive">10</property> <property name="hibernate.dbcp.whenExhaustedAction">1</property> <property name="hibernate.dbcp.maxWait">20000</property> <property name="hibernate.dbcp.maxIdle">10</property>
<!-- prepared statement cache--> <property name="hibernate.dbcp.ps.maxActive">10</property> <property name="hibernate.dbcp.ps.whenExhaustedAction">1</property> <property name="hibernate.dbcp.ps.maxWait">20000</property> <property name="hibernate.dbcp.ps.maxIdle">10</property>
<!-- optional query to validate pooled connections:--> <property name="hibernate.dbcp.validationQuery">select 1</property> <property name="hibernate.dbcp.testOnBorrow">true</property> <property name="hibernate.dbcp.testOnReturn">true</property>
<mapping resource="mapping/Departement.hbm.xml" /> <mapping resource="mapping/Poste.hbm.xml" /> <mapping resource="mapping/Staff.hbm.xml" /> <mapping resource="mapping/Menu.hbm.xml" /> <mapping resource="mapping/Login.hbm.xml" /> <mapping resource="mapping/Nouvelles.hbm.xml" /> <mapping resource="mapping/Promotion.hbm.xml" /> <mapping resource="mapping/Equipe.hbm.xml" /> <mapping resource="mapping/Joueur.hbm.xml" /> <mapping resource="mapping/Equipejoueur.hbm.xml" /> <mapping resource="mapping/Equipestaff.hbm.xml" /> <mapping resource="mapping/Fan.hbm.xml" /> <mapping resource="mapping/Partie.hbm.xml" /> <mapping resource="mapping/Partenaire.hbm.xml" />
</session-factory>
</hibernate-configuration> /b]
[b]Full stack trace of any exception that occurs:
2006-08-28 10:52:43 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception org.hibernate.exception.GenericJDBCException: could not execute query at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92) at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:1596) at org.hibernate.loader.Loader.list(Loader.java:1577) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:111) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1322) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:300) at view.ShowNouvelles.showResume(ShowNouvelles.java:194) at org.apache.jsp.accueil_jsp._jspService(accueil_jsp.java:129) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675) at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:534) Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException MESSAGE: Broken pipe
STACKTRACE:
java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66) at java.io.BufferedOutputStream.write(BufferedOutputStream.java:110) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2635) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1554) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665) at com.mysql.jdbc.Connection.execSQL(Connection.java:3124) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1146) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1259) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120) at org.hibernate.loader.Loader.getResultSet(Loader.java:1272) at org.hibernate.loader.Loader.doQuery(Loader.java:391) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218) at org.hibernate.loader.Loader.doList(Loader.java:1593) at org.hibernate.loader.Loader.list(Loader.java:1577) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:111) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1322) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:300) at view.ShowNouvelles.showResume(ShowNouvelles.java:194) at org.apache.jsp.accueil_jsp._jspService(accueil_jsp.java:129) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675) at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:534)
** END NESTED EXCEPTION **
If someone have an idea, it would help me a lot ... thank you
|