Hibernate version:
2.1.7
Name and version of the database you are using:
MySQL 4.0.18
I'm having trouble getting the proxool 0.8.3 connection pooler to work with hibernate.
I followed the instructions found at
http://www.hibernate.org/222.html, with the following variations:
1. I'm using hibernate.cfg.xml, not hibernate.properties, so I've configured it like this (proxool doesn't support DataSource, unfortunately):
Code:
<property name="hibernate.proxool.pool_alias">myalias</property>
<property name="hibernate.proxool.properties">proxool.properties</property>
2. the example proxool.properties file used myname instead of myalias. I assumed this was a typo and used myalias instead.
My proxool.properties file is as follows:
Code:
# the pool alias (name comes from the hibernate.properties)
# (don't forget Hibernate adds the 'hibernate-' prefix to your pool alias)
#
jdbc-0.proxool.alias=hibernate-myalias
jdbc-0.proxool.driver-class=com.mysql.jdbc.Driver
jdbc-0.proxool.driver-url=jdbc:mysql://127.0.0.1/lister?useUnicode=true&characterEncoding=SJIS
jdbc-0.user=testuser
jdbc-0.password=testpassword
jdbc-0.proxool.house-keeping-sleep-time=30000
jdbc-0.proxool.house-keeping-test-sql=select 1 from dual
jdbc-0.proxool.test-before-use=tru
jdbc-0.proxool.test-after-user=false
When I run my application, I get the following error:
Quote:
2004-12-10 15:31:32 StandardWrapperValve[AdminControllerServlet]: Servlet.service() for servlet AdminControllerServlet threw
exception
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.somewhere.common.webapp.RequestEvent.execute(RequestEvent.java:79)
at com.somewhere.common.webapp.ControllerServlet.doGet(ControllerServlet.java:93)
at com.somewhere.common.webapp.ControllerServlet.doPost(ControllerServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at com.somewhere.common.webapp.MultiSearchAndReplaceFilter.doFilter(MultiSearchAndReplaceFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at com.somewhere.lister.data.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at com.somewhere.lister.EncodingFilter.doFilter(EncodingFilter.java:56)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at com.somewhere.lister.LocaleFilter.doFilter(LocaleFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at com.somewhere.common.idx.webapp.CarrierFilter.doFilter(CarrierFilter.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at com.somewhere.common.idx.webapp.CarrierFilter.doFilter(CarrierFilter.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at com.somewhere.common.util.IdentifierFilter.doFilter(IdentifierFilter.java:103)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:696)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:534)
Caused by: com.somewhere.lister.data.DataException: net.sf.hibernate.exception.GenericJDBCException: Cannot open connec
tion
at com.somewhere.lister.data.AdministratorPersistence.getAdministrator(AdministratorPersistence.java:47)
at com.somewhere.lister.event.admin.CommonEvents.doLogin(CommonEvents.java:50)
... 53 more
Caused by: net.sf.hibernate.exception.GenericJDBCException: Cannot open connection
at net.sf.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:81)
at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:30)
at net.sf.hibernate.impl.BatcherImpl.convert(BatcherImpl.java:325)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:292)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3361)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3321)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:66)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:779)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3648)
at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
at com.somewhere.lister.data.AdministratorPersistence.getAdministrator(AdministratorPersistence.java:40)
... 54 more
Caused by: java.sql.SQLException: org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its
alias 'myalias'
at org.logicalcobwebs.proxool.ProxoolDriver.connect(ProxoolDriver.java:108)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at net.sf.hibernate.connection.ProxoolConnectionProvider.getConnection(ProxoolConnectionProvider.java:55)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:289)
... 66 more
Until now, I've been running this application using DBCP, but I need to change it to use some other pooling mechanism since DBCP and Hibernate don't seem to get along very well when the server's under heavy load (lost & unclosable connections from time to time until the pooler is eventually completely crippled)
Can someone help me get this to work, or recommend another pooler? I'm not too keen on using c3p0 since its release notes say that it still contains a lot of untested code (i.e. not production ready).