Strange Exception

From: Gary Jarrel (garyjarre..mail.com)
Date: Fri Jan 11 2008 - 19:42:10 EST

  • Next message: Aristedes Maniatis: "Re: Strange Exception"

    Hi All!

    'm havign a strange problem under Cayenne 3.0M2 which is very intermitent.
    Using a web application backed by Cayenne, the user modifies property
    records in the database via a web interface. Everything runs fine until one
    of the modifications cause the following exception:

    [2008-01-12 11:32:13,174] ERROR org.mortbay.log (JCLLoggerAdapter.java:543)
    - Nested in javax.servlet.ServletException: [v.3.0M2 Oct 28 2007 16:09:02]
    Commit Exception:
    org.apache.cayenne.CayenneRuntimeException: [v.3.0M2 Oct 28 2007 16:09:02]
    Commit Exception
            at org.apache.cayenne.access.DataContext.flushToParent(
    DataContext.java:1202)
            at org.apache.cayenne.access.DataContext.commitChanges(
    DataContext.java:1083)
            at au.com.jarrel.commons.db.cayenne.dao.impl.BaseDaoImpl.commit(
    BaseDaoImpl.java:91)
            at
    au.com.hybridkinetic.jarrel.web.action.admin.listing.AddListing.runAction(
    AddListing.java:72)
            at au.com.hybridkinetic.jarrel.web.action.BaseAction.execute(
    BaseAction.java:80)
            at org.apache.struts.action.RequestProcessor.processActionPerform(
    RequestProcessor.java:431)
            at org.apache.struts.action.RequestProcessor.process(
    RequestProcessor.java:236)
            at org.apache.struts.action.ActionServlet.process(ActionServlet.java
    :1196)
            at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java
    :432)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java
    :487)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
    ServletHandler.java:1087)
            at net.sf.ehcache.constructs.web.filter.GzipFilter.doFilter(
    GzipFilter.java:75)
            at net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java
    :92)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
    ServletHandler.java:1078)
            at
    org.riotfamily.common.web.filter.CharacterEncodingFilter.doFilterInternal(
    CharacterEncodingFilter.java:95)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(
    OncePerRequestFilter.java:75)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
    ServletHandler.java:1078)
            at
    au.com.jarrel.commons.db.cayenne.i18n.web.filter.LocaleEnforecementFilter.doFilter
    (LocaleEnforecementFilter.java:59)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
    ServletHandler.java:1078)
            at
    au.com.jarrel.commons.db.cayenne.i18n.web.filter.JstlLocaleFilter.doFilter(
    JstlLocaleFilter.java:125)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
    ServletHandler.java:1078)
            at
    au.com.jarrel.commons.db.cayenne.i18n.web.filter.LocaleSettingFilter.doFilter
    (LocaleSettingFilter.java:110)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
    ServletHandler.java:1078)
            at au.com.hybridkinetic.jarrel.web.RequestUrlFilter.doFilter(
    RequestUrlFilter.java:52)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
    ServletHandler.java:1078)
            at
    org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(
    FilterChainProxy.java:265)
            at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(
    FilterSecurityInterceptor.java:107)
            at
    org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(
    FilterSecurityInterceptor.java:72)
            at
    org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(
    FilterChainProxy.java:275)
            at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(
    ExceptionTranslationFilter.java:110)
            at
    org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(
    FilterChainProxy.java:275)
            at
    org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(
    AnonymousProcessingFilter.java:125)
            at
    org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(
    FilterChainProxy.java:275)
            at
    org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(
    SecurityContextHolderAwareRequestFilter.java:81)
            at
    org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(
    FilterChainProxy.java:275)
            at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(
    AbstractProcessingFilter.java:229)
            at
    org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(
    FilterChainProxy.java:275)
            at org.acegisecurity.ui.logout.LogoutFilter.doFilter(
    LogoutFilter.java:106)
            at
    org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(
    FilterChainProxy.java:275)
            at
    org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(
    HttpSessionContextIntegrationFilter.java:286)
            at
    org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(
    FilterChainProxy.java:275)
            at org.acegisecurity.util.FilterChainProxy.doFilter(
    FilterChainProxy.java:149)
            at org.acegisecurity.util.FilterToBeanProxy.doFilter(
    FilterToBeanProxy.java:98)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
    ServletHandler.java:1078)
            at org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(
    WebApplicationContextFilter.java:91)
            at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
    ServletHandler.java:1078)
            at org.mortbay.jetty.servlet.ServletHandler.handle(
    ServletHandler.java:361)
            at org.mortbay.jetty.security.SecurityHandler.handle(
    SecurityHandler.java:216)
            at org.mortbay.jetty.servlet.SessionHandler.handle(
    SessionHandler.java:181)
            at org.mortbay.jetty.handler.ContextHandler.handle(
    ContextHandler.java:712)
            at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java
    :406)
            at org.mortbay.jetty.handler.ContextHandlerCollection.handle(
    ContextHandlerCollection.java:211)
            at org.mortbay.jetty.handler.HandlerCollection.handle(
    HandlerCollection.java:114)
            at org.mortbay.jetty.handler.HandlerWrapper.handle(
    HandlerWrapper.java:139)
            at org.mortbay.jetty.Server.handle(Server.java:309)
            at org.mortbay.jetty.HttpConnection.handleRequest(
    HttpConnection.java:506)
            at org.mortbay.jetty.HttpConnection$RequestHandler.content(
    HttpConnection.java:844)
            at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
            at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
            at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
            at org.mortbay.io.nio.SelectChannelEndPoint.run(
    SelectChannelEndPoint.java:396)
            at org.mortbay.thread.BoundedThreadPool$PoolThread.run(
    BoundedThreadPool.java:442)
    Caused by: java.lang.NullPointerException
            at org.apache.cayenne.access.DataContext$1.visitToOne(
    DataContext.java:599)
            at org.apache.cayenne.reflect.generic.DataObjectToOneProperty.visit(
    DataObjectToOneProperty.java:85)
            at
    org.apache.cayenne.reflect.PersistentDescriptor.visitDeclaredProperties(
    PersistentDescriptor.java:323)
            at org.apache.cayenne.reflect.PersistentDescriptor.visitProperties(
    PersistentDescriptor.java:358)
            at
    org.apache.cayenne.reflect.LazyClassDescriptorDecorator.visitProperties(
    LazyClassDescriptorDecorator.java:138)
            at org.apache.cayenne.access.DataContext.currentSnapshot(
    DataContext.java:543)
            at org.apache.cayenne.access.DataDomainSyncBucket.postprocess(
    DataDomainSyncBucket.java:230)
            at org.apache.cayenne.access.DataDomainFlushAction.postprocess(
    DataDomainFlushAction.java:240)
            at org.apache.cayenne.access.DataDomainFlushAction.flush(
    DataDomainFlushAction.java:148)
            at org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java
    :827)
            at org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java
    :794)
            at org.apache.cayenne.access.DataDomain.runInTransaction(
    DataDomain.java:853)
            at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:791)
            at org.apache.cayenne.access.DataContext.flushToParent(
    DataContext.java:1170)
            ... 63 more

    I can not seem to establish a pattern to why this happens, it will usually
    happen within the first 10 - 15 commits the application does, after the
    server starts.

    I've started checking the objects in the context. When the commit works fine
    there are no modified and/or uncommitted objects in the graph. But as soon
    as this happens there graph contains the object/record which I was working
    with in both modified and committed state. This object is then stuck in the
    context so any further work with the application would cause the same
    failure.

    The main question is if anyone has any clue to what could cause this
    exception?

    The second is how do people handle objects handing around in the graph if an
    exception is thrown during comit? Perhaps one solution is to catch the
    Exception in the web filter, rollback any changes on the context and remove
    all the dirty objects in the graph? But this does not sound very clean to
    me?

    Thank you in advance!

    Cheers,
    Gary



    This archive was generated by hypermail 2.0.0 : Fri Jan 11 2008 - 19:42:45 EST