-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Connection Pool Problem
PostPosted: Wed Dec 14, 2005 4:56 am 
Newbie

Joined: Wed Dec 14, 2005 3:12 am
Posts: 1
Hi

I’ve a problem. I try to change the version of Hibernate from 2.x to 3.x but I’ve the problem with my pool.

The old configuration file was this:


<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

<session-factory>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="query.imports">cirrus.hibernate.test</property>
<property name="connection.pool_size">2</property>
<property name="statement_cache.size">100</property>
<property name="show_sql">false</property>
<property name="jdbc.batch_size">0</property>
<property name="jdbc.use_scrollable_resultset">true</property>
<property name="jdbc.use_streams_for_binary">true</property>

<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.username">user</property>
<property name="connection.password">pwd</property>
<property name="connection.url">jdbc:oracle:thin:@10.10.21.21:1521:test</property>

<property name="dbcp.maxActive">2</property>
<property name="dbcp.maxIdle">2</property>
<property name="dbcp.maxWait">1</property>
<property name="dbcp.validationQuery">select 2 from dual</property>
<property name="dbcp.whenExhaustedAction">2</property>
<property name="dbcp.testOnBorrow">true</property>
<property name="dbcp.testOnReturn">false</property>

<property name="dbcp.ps.maxActive">2</property>
<property name="dbcp.ps.whenExhaustedAction">2</property>
<property name="dbcp.ps.maxWait">1</property>
<property name="dbcp.ps.maxIdle">2</property>

<!—List of mapping à


with this configuration I was able to use directly DBCP and all worked fine.



The new configuration file is this:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="query.imports">cirrus.hibernate.test</property>
<property name="connection.pool_size">2</property>
<property name="statement_cache.size">100</property>
<property name="show_sql">true</property>
<property name="jdbc.batch_size">0</property>
<property name="jdbc.use_scrollable_resultset">true</property>
<property name="jdbc.use_streams_for_binary">true</property>

<property name="hibernate.cglib.use_reflection_optimizer">false</property>

<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="connection.driver_class">oracle.jdbc2.driver.OracleDriver</property>
<property name="connection.username">user</property>
<property name="connection.password">pwd</property>
<property name="connection.url">jdbc:oracle:thin:@10.10.21.21:1521:test</property>





but in this case I cannot use DBCP pool, the application works fine but after 20 minutes (the oracle connection time out) the connection has a time out.

I try to use the following configuration:



<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<property name="hibernate.query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="hibernate.query.imports">cirrus.hibernate.test</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/manifesti</property>
<property name="hibernate.default-lazy">false</property>

<property name="hibernate.jdbc.batch_size">0</property>
<property name="hibernate.jdbc.use_scrollable_resultset">true</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>



but in this case the application doesn’t work. I cannot save my object. I think that the problem is in the property “hibernate.jdbc.use_scrollable_resultset” that isn’t used correctly.


A part of log file is this:



2002-12-12 17:41:25,093 WARN [TP-Processor7] org.hibernate.util.JDBCExceptionReporter (JDBCExceptionReporter.java:71) -SQL Error: 1002, SQLState: 72000

2002-12-12 17:41:25,093 ERROR [TP-Processor7] org.hibernate.util.JDBCExceptionReporter (JDBCExceptionReporter.java:72) -ORA-01002: cursore non valido


2002-12-12 17:41:25,093 INFO [TP-Processor7] org.hibernate.event.def.DefaultLoadEventListener (DefaultLoadEventListener.java:85) -Error performing load command

org.hibernate.exception.GenericJDBCException: could not lock: [com.set.edi.manifesti.Partner#26]

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.persister.entity.BasicEntityPersister.lock(BasicEntityPersister.java:1003)

at org.hibernate.event.def.AbstractLockUpgradeEventListener.upgradeLock(AbstractLockUpgradeEventListener.java:77)

at org.hibernate.event.def.DefaultLoadEventListener.loadFromSessionCache(DefaultLoadEventListener.java:392)

at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:295)

at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:113)

at org.hibernate.event.def.DefaultLoadEventListener.lockAndLoad(DefaultLoadEventListener.java:257)

at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:79)

at org.hibernate.impl.SessionImpl.get(SessionImpl.java:671)

at org.hibernate.impl.SessionImpl.get(SessionImpl.java:666)

at com.set.edi.persistance.hibernate.PersistentObjectDAO.updatePersistentObject(PersistentObjectDAO.java:136)

at com.set.edi.manifesti.ManifestBean.updatePartnerMan(ManifestBean.java:849)

at com.set.edi.manifesti.web.PartnerAction.loadPartInfo(PartnerAction.java:205)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)

at com.set.edi.manifesti.web.BaseManifestAction.dispatchMethod(BaseManifestAction.java:62)

at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)

at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)

at com.set.edi.manifesti.web.PreLoadFilter.doFilter(PreLoadFilter.java:258)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)

at com.set.edi.persistance.hibernate.NamedPersistanceFilter.doFilter(NamedPersistanceFilter.java:144)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)

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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)

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.StandardHostValve.invoke(StandardHostValve.java:137)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:444)

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:683)

at java.lang.Thread.run(Thread.java:534)




Does someone know how to configure correctly the property? I need to use a DBCP connection pool.

Help me, I’ve to install the new release this weekend.

Thank you

Marco


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 22, 2006 3:03 am 
Newbie

Joined: Tue May 10, 2005 2:32 pm
Posts: 14
Location: Quito, Ecuador South America
Hello,

I do not Know If you solved your problem already but Hibernate3 does not work with dbcp anymore so you need to use a custom connection Provider. I have the same problem, but found this provider at hibernate wiki http://wiki.apache.org/jakarta-commons/DBCP/Hibernate

Try it, but it does not work with transactions. If you have more than 2 different calls to saveOrUpdate it gets more than one conection so when you call to session.commit it does not found an openned connection wich cause and error. I am still working on this error

_________________
Hernan Leon
Mindsoft


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.