You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Dustin N. Jenkins" <dj...@invoqsystems.com> on 2005/09/02 20:16:49 UTC

Cocoon Hangs with OpenSessionInViewFilter

Tools: JDK 1.5.0_04, Spring 1.2.1, Hibernate 3.0.5, Cocoon 2.1.7

We've been using the OpenSessionInViewFilter for months now without much 
incident at all (aside from the usual carelessness that comes with 
closing and opening sessions around HTTP Requests).  Lately though, 
there's been this error that happens when I save a collection of 
entities and try to reload them.  The errors below happen when the 
application hangs and I have to shut down the Jetty web server.  It 
hangs after the opening JDBC connection line:

     [java] 2005-09-02 10:17:23,057 [PoolThread-4] DEBUG - more......
     [java] 2005-09-02 10:17:23,057 [PoolThread-4] DEBUG - executing flush
     [java] 2005-09-02 10:17:23,057 [PoolThread-4] DEBUG - post flush
     [java] 2005-09-02 10:17:23,057 [PoolThread-4] DEBUG - opened 
session at timestamp: 4610791190761472
     [java] 2005-09-02 10:17:23,058 [PoolThread-4] DEBUG - find: from 
com.invoqsystems.apex.access.DefaultAdministrativeGroupImpl ag where 
ag.organization = ?
     [java] 2005-09-02 10:17:23,058 [PoolThread-4] DEBUG - parameters: 
[com.invoqsystems.apex.model.location.Organization#1]
     [java] 2005-09-02 10:17:23,058 [PoolThread-4] DEBUG - named 
parameters: {}
     [java] 2005-09-02 10:17:23,058 [PoolThread-4] DEBUG - compile() : 
The query is already compiled, skipping...
     [java] 2005-09-02 10:17:23,058 [PoolThread-4] DEBUG - about to open 
PreparedStatement (open PreparedStatements: 0, globally: 0)
     [java] 2005-09-02 10:17:23,058 [PoolThread-4] DEBUG - opening JDBC 
connection


=== THE APPLICATION HANGS HERE ===

=== I SHUT IT DOWN AFTERWARDS... ===

     [java] 10:19:06.762 EVENT  Shutdown hook executing
     [java] 10:19:06.763 EVENT  Stopping Acceptor 
ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8888]
     [java] 10:19:06.774 EVENT  Stopped SocketListener on 0.0.0.0:8888
     [java] 10:19:06.775 EVENT  Closing Spring root WebApplicationContext
     [java] 2005-09-02 10:19:06,776 [Shutdown] INFO - closing
     [java] 2005-09-02 10:19:06,783 [Shutdown] ERROR - Destroy method on 
bean with name 'sessionFactory' threw an exception
     [java] java.lang.IllegalStateException: The cocoon-ehcache-1 Cache 
is not alive.
     [java]     at net.sf.ehcache.Cache.checkStatus(Cache.java:713)
     [java]     at net.sf.ehcache.Cache.dispose(Cache.java:618)
     [java]     at 
net.sf.ehcache.CacheManager.shutdown(CacheManager.java:382)
     [java]     at 
org.hibernate.cache.EhCacheProvider.stop(EhCacheProvider.java:137)
     [java]     at 
org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:803)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
     [java]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
     [java]     at 
org.springframework.orm.hibernate3.LocalSessionFactoryBean$TransactionAwareInvocationHandler.invoke(LocalSessionFactoryBean.java:962)
     [java]     at $Proxy0.close(Unknown Source)
     [java]     at 
org.springframework.orm.hibernate3.LocalSessionFactoryBean.destroy(LocalSessionFactoryBean.java:923)
     [java]     at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.destroy(AbstractBeanFactory.java:868)
     [java]     at 
org.springframework.beans.factory.support.AbstractBeanFactory.destroyBean(AbstractBeanFactory.java:950)
     [java]     at 
org.springframework.beans.factory.support.AbstractBeanFactory.destroyDisposableBean(AbstractBeanFactory.java:926)
     [java]     at 
org.springframework.beans.factory.support.AbstractBeanFactory.destroySingletons(AbstractBeanFactory.java:530)
     [java]     at 
org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:511)
     [java]     at 
org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:290)
     [java]     at 
org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:71)
     [java]     at 
org.mortbay.jetty.servlet.WebApplicationContext.stop(WebApplicationContext.java:494)
     [java]     at org.mortbay.http.HttpContext.stop(HttpContext.java:1949)
     [java]     at org.mortbay.http.HttpServer.stop(HttpServer.java:732)
     [java]     at org.mortbay.http.HttpServer.stop(HttpServer.java:700)
     [java]     at org.mortbay.jetty.Server$1.run(Server.java:455)
     [java] 2005-09-02 10:19:06,791 [PoolThread-4] DEBUG - after autocommit
     [java] 2005-09-02 10:19:06,791 [PoolThread-4] DEBUG - after 
transaction completion
     [java] 
"file:/usr/local/webserver/webapp/configmgr/flow/UI_Flow.js", line 
2,243: uncaught JavaScript exception:
     [java] at AdministrativeGroups 
(file:/usr/local/webserver/webapp/configmgr/flow/UI_Flow.js, Line 2243):
     [java] java.lang.IllegalStateException: Pool not open
     [java] 2005-09-02 10:19:06,994 [PoolThread-4] DEBUG - closing session
     [java] 2005-09-02 10:19:06,996 [PoolThread-4] DEBUG - closing JDBC 
connection [ (open PreparedStatements: 0, globally: 1) (open ResultSets: 
0, globally: 0)]
     [java] 2005-09-02 10:19:06,997 [PoolThread-4] DEBUG - after 
transaction completion
     [java] 2005-09-02 10:19:06,997 [PoolThread-4] DEBUG - after 
transaction completion
     [java] 2005-09-02 10:19:06,997 [PoolThread-4] ERROR - Unexpected 
exception on closing Hibernate Session
     [java] java.lang.IllegalStateException: Pool not open
     [java]     at 
org.apache.commons.pool.BaseObjectPool.assertOpen(BaseObjectPool.java:123)
     [java]     at 
org.apache.commons.pool.impl.GenericObjectPool.returnObject(GenericObjectPool.java:898)
     [java]     at 
org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:80)
     [java]     at 
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:180)
     [java]     at 
org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.closeConnection(LocalDataSourceConnectionProvider.java:94)
     [java]     at 
org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:327)
     [java]     at 
org.hibernate.jdbc.ConnectionManager.cleanup(ConnectionManager.java:262)
     [java]     at 
org.hibernate.jdbc.ConnectionManager.close(ConnectionManager.java:194)
     [java]     at 
org.hibernate.impl.SessionImpl.close(SessionImpl.java:289)
     [java]     at 
org.springframework.orm.hibernate3.SessionFactoryUtils.doClose(SessionFactoryUtils.java:775)
     [java]     at 
org.springframework.orm.hibernate3.SessionFactoryUtils.processDeferredClose(SessionFactoryUtils.java:712)
     [java]     at 
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:190)
     [java]     at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
     [java]     at 
org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
     [java]     at 
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:286)
     [java]     at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
     [java]     at 
org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
     [java]     at 
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
     [java]     at 
org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
     [java]     at org.mortbay.http.HttpServer.service(HttpServer.java:879)
     [java]     at 
org.mortbay.http.HttpConnection.service(HttpConnection.java:789)
     [java]     at 
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960)
     [java]     at 
org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
     [java]     at 
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
     [java]     at 
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:300)
     [java]     at 
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:511)
     [java] 2005-09-02 10:19:07,000 [PoolThread-4] DEBUG - closing session
     [java] 2005-09-02 10:19:07,001 [PoolThread-4] DEBUG - closing session
     [java] 2005-09-02 10:19:07,001 [PoolThread-4] DEBUG - closing JDBC 
connection [ (open PreparedStatements: 0, globally: 1) (open ResultSets: 
0, globally: 0)]
     [java] 2005-09-02 10:19:07,001 [PoolThread-4] DEBUG - after 
transaction completion
     [java] 2005-09-02 10:19:07,001 [PoolThread-4] DEBUG - after 
transaction completion


Anyone know what to do about this?  I'll probably go to the Hibernate 
forums with it too, but I wanted to start here.  I could upgrade to the 
latest Spring too just to cover my bases...

Many thanks,
Dustin


-- 
Dustin N. Jenkins
Application Developer
Invoq Systems, Inc.
AlarmPoint - Guaranteed Event Resolution
#216 - 852 Fort Street
Victoria, BC V8W 1H8
Tel: (250) 380-0304
djenkins@invoqsystems.com <ma...@invoqSystems.com>
http://www.invoqsystems.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon Hangs with OpenSessionInViewFilter

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Dustin N. Jenkins wrote:
> That's exactly what I have actually.  I'm still not clear as to what 
> C3P0 handles, but if I'm indeed using the data source as laid out below, 
> and injecting that into my Hibernate Session Factory, which is then 
> being injected into my DAOs, does it mean I'm not using C3P0?
> Anyway, adding a c3p0.properties as I mentioned below and trying some 
> tuning didn't help at all.
Exactly. You're NOT using c3p0 then.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon Hangs with OpenSessionInViewFilter

Posted by Pete Farmer <pe...@gmail.com>.
On 9/7/05, Mark Lundquist <ml...@wrinkledog.com> wrote:
>
> On Sep 6, 2005, at 4:17 PM, Dustin N. Jenkins wrote:
>
> > That's exactly what I have actually.  I'm still not clear as to what
> > C3P0 handles, but if I'm indeed using the data source as laid out
> > below, and injecting that into my Hibernate Session Factory, which is
> > then being injected into my DAOs, does it mean I'm not using C3P0?
>
> Yes.

Hi Dustin,

I run into a similar situation, and I'm wondering if your's was ever
resolved satisfactorily?

My current software stack looks like MySQL 4.1 + Hibernate 3.0 +
Tomcat 5.5.9 + Cocoon 2.1.7.

The situation is that after the first call to hs.save(mydata)
something kills  ehcache-1 (see stack trace below).


Grateful for any insight. I'm currently trying to determine whether my
Hibernate configuration is correct.

best,
--pete



The DEBUG level messages for core.store look like this:

--------------------------<snip/>------------------
DEBUG   (2005-10-17) 23:37.50:804   [core.store] (/cocoon/)
http-8080-Processor25/EHDefaultStore: NOT Found key:
PK_G-file-file:/usr/local/bin/tomcat/webapps/cocoon/welcome.xml_T-xslt-file:/usr/local/bin/tomcat/webapps/cocoon/welcome.xslt;contextPath=/cocoon_S-xhtml-;doctype-public=-//W3C//DTD
XHTML 1.0 Strict//EN;doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;encoding=UTF-8
DEBUG   (2005-10-17) 23:37.50:864   [core.store] (/cocoon/)
http-8080-Processor25/EHDefaultStore: Store object
org.apache.cocoon.caching.CachedResponse@17b1c02 with key
PK_G-file-file:/usr/local/bin/tomcat/webapps/cocoon/welcome.xml_T-xslt-file:/usr/local/bin/tomcat/webapps/cocoon/welcome.xslt;contextPath=/cocoon_S-xhtml-;doctype-public=-//W3C//DTD
XHTML 1.0 Strict//EN;doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;encoding=UTF-8



--------------------------<snip/>------------------
full exception chain stacktrace[hide]

java.lang.IllegalStateException: The cocoon-ehcache-1 Cache is not alive.
	at net.sf.ehcache.Cache.checkStatus(Cache.java:713)
	at net.sf.ehcache.Cache.get(Cache.java:355)
	at org.apache.cocoon.components.store.impl.EHDefaultStore.get(EHDefaultStore.java:242)
	at org.apache.cocoon.caching.impl.CacheImpl.get(CacheImpl.java:97)
	at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.validatePipeline(AbstractCachingProcessingPipeline.java:431)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon Hangs with OpenSessionInViewFilter

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Sep 6, 2005, at 4:17 PM, Dustin N. Jenkins wrote:

> That's exactly what I have actually.  I'm still not clear as to what 
> C3P0 handles, but if I'm indeed using the data source as laid out 
> below, and injecting that into my Hibernate Session Factory, which is 
> then being injected into my DAOs, does it mean I'm not using C3P0?

Yes.

If I'm not mistaken, if you have top-level "info" logging turned on in 
your log4j.properties you will see some dumpage when the connection 
pool fires up if you are using c3p0... if you don't see that, then it's 
not there.

Also — I could be wrong about this, but I *think* that if you want to 
tell Hibernate to use c3p0, the c3p0.* properties need to be included 
in hibernate.properties (or hibernate.cfg.xml using the standard 
Hibernate syntax for properties in XML).

—ml—


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon Hangs with OpenSessionInViewFilter

Posted by "Dustin N. Jenkins" <dj...@invoqsystems.com>.
That's exactly what I have actually.  I'm still not clear as to what 
C3P0 handles, but if I'm indeed using the data source as laid out below, 
and injecting that into my Hibernate Session Factory, which is then 
being injected into my DAOs, does it mean I'm not using C3P0? 

Anyway, adding a c3p0.properties as I mentioned below and trying some 
tuning didn't help at all.

Thanks,
Dustin




Leszek Gawron wrote:

> Dustin N. Jenkins wrote:
>
>> I'm using the default c3p0 pooling, so I think I'll try adding a 
>> c3p0.properties to try and work it out a little bit.  My 
>> cocoon-ehcache-1.* files both have a size of zero, but I deleted them 
>> anyway with no good result.  I've never seen this before and I'm 
>> worried it's the way my code is working.  I'm deleting a collection 
>> of entities, then creating a new list of them.  I don't explicitly 
>> open sessions as everything is taken care of via Spring and carried 
>> over to Cocoon with the OpenSessionInViewFilter.
>
> Just for "fun" try switching to DBCP and see if your error occurs. 
> Here you have a configuration snippet.
>
> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" 
> destroy-method="close">
>     <property name="driverClassName">
>         <value>${db.driver}</value>
>     </property>
>     <property name="url">
>         <value>${db.url}</value>
>     </property>
>     <property name="username">
>         <value>${db.username}</value>
>     </property>
>     <property name="password">
>         <value>${db.password}</value>
>     </property>
> </bean>
>

-- 
Dustin N. Jenkins
Application Developer
Invoq Systems, Inc.
AlarmPoint - Guaranteed Event Resolution
#216 - 852 Fort Street
Victoria, BC V8W 1H8
Tel: (250) 380-0304
djenkins@invoqsystems.com <ma...@invoqSystems.com>
http://www.invoqsystems.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon Hangs with OpenSessionInViewFilter

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Dustin N. Jenkins wrote:
> I'm using the default c3p0 pooling, so I think I'll try adding a 
> c3p0.properties to try and work it out a little bit.  My 
> cocoon-ehcache-1.* files both have a size of zero, but I deleted them 
> anyway with no good result.  I've never seen this before and I'm worried 
> it's the way my code is working.  I'm deleting a collection of entities, 
> then creating a new list of them.  I don't explicitly open sessions as 
> everything is taken care of via Spring and carried over to Cocoon with 
> the OpenSessionInViewFilter.
Just for "fun" try switching to DBCP and see if your error occurs. Here 
you have a configuration snippet.

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" 
destroy-method="close">
	<property name="driverClassName">
		<value>${db.driver}</value>
	</property>
	<property name="url">
		<value>${db.url}</value>
	</property>
	<property name="username">
		<value>${db.username}</value>
	</property>
	<property name="password">
		<value>${db.password}</value>
	</property>
</bean>

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon Hangs with OpenSessionInViewFilter

Posted by "Dustin N. Jenkins" <dj...@invoqsystems.com>.
I'm using the default c3p0 pooling, so I think I'll try adding a 
c3p0.properties to try and work it out a little bit.  My 
cocoon-ehcache-1.* files both have a size of zero, but I deleted them 
anyway with no good result.  I've never seen this before and I'm worried 
it's the way my code is working.  I'm deleting a collection of entities, 
then creating a new list of them.  I don't explicitly open sessions as 
everything is taken care of via Spring and carried over to Cocoon with 
the OpenSessionInViewFilter.

Thanks for the suggestions.  If anyone thinks of anything, it'd be 
muchly appreciated.
Dustin



Laurent Perez wrote:

>Sounds like either a dbcp misconfiguration ("Pool not open") or a
>cache corruption.
>Locate and delete cocoon-ehcache-1.index and cocoon-ehcache-1.data, it
>might help.
>
>If this error didn't happen before, I'd say the jars are version safe,
>but something on the database side or filesystem side (i.e cache
>written to disk) is going wrong under load, if this is a production
>server.
>
>Laurent
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>  
>

-- 
Dustin N. Jenkins
Application Developer
Invoq Systems, Inc.
AlarmPoint - Guaranteed Event Resolution
#216 - 852 Fort Street
Victoria, BC V8W 1H8
Tel: (250) 380-0304
djenkins@invoqsystems.com <ma...@invoqSystems.com>
http://www.invoqsystems.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon Hangs with OpenSessionInViewFilter

Posted by Laurent Perez <ha...@gmail.com>.
Sounds like either a dbcp misconfiguration ("Pool not open") or a
cache corruption.
Locate and delete cocoon-ehcache-1.index and cocoon-ehcache-1.data, it
might help.

If this error didn't happen before, I'd say the jars are version safe,
but something on the database side or filesystem side (i.e cache
written to disk) is going wrong under load, if this is a production
server.

Laurent

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon Hangs with OpenSessionInViewFilter

Posted by Mark Lundquist <ml...@wrinkledog.com>.
This could also be a connection pool issue maybe?  Which one are you 
using?

On Sep 2, 2005, at 11:16 AM, Dustin N. Jenkins wrote:

> Tools: JDK 1.5.0_04, Spring 1.2.1, Hibernate 3.0.5, Cocoon 2.1.7
> <snip...>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org