1 Reply Latest reply on Aug 1, 2006 5:44 PM by kukeltje

    LazyInitializationException with ExtensionsFilter

    derjohannes

      I am still stuck in this problem:
      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=87720

      Although I learned much about Filters and the web.xml deployment descriptor in the last few days, i do not get the jBPM Starter's Kit to work after inserting the following entry into web.xml:


      <filter-name>ExtensionsFilter</filter-name>
      <filter-class>
      org.apache.myfaces.component.html.util.ExtensionsFilter
      </filter-class>

      <filter-mapping>
      <filter-name>ExtensionsFilter</filter-name>
      <servlet-name>FacesServlet</servlet-name>
      </filter-mapping>

      (Although this is the way recommended under
      http://www.onjava.com/pub/a/onjava/2005/07/13/jsfupload.html?page=2 )

      No matter, in which order I put the filter-mappings, no matter if I use a <servlet-name>-mapping or an <url-pattern>-mapping, no matter if I map the ExtensionsFilter before the FacesServlet or after it, to "/*" or to a certain .jsp-page (even if i map it to a jsp that is not accessed at all!)...
      ...the Hibernate session gets closed mysteriosly, and I get the following error:

      18:36:32,274 ERROR [LazyInitializationException] could not initialize proxy - the owning Session was closed
      org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
      at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:56)
      at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98)
      at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:133)
      at org.jbpm.taskmgmt.exe.TaskInstance$$EnhancerByCGLIB$$c63bf161.getTaskMgmtInstance()
      at org.jbpm.JbpmContext.save(JbpmContext.java:297)


      If I've understood it right, theoretically, every request passes the chain of filters described in web.xml in the order they appear resp. in the order the filter mappings are defined.

      Theoretically, the org.apache.myfaces.component.html.util.ExtensionsFilter only applies its filter if the request is of the type enctype="multipart/form-data". So there should be no problem if the form hasn't the attribute enctype="multipart/form-data".

      But the JSF application keeps on crashing, no matter what I do.

      Can anyone give me a hint how I can integrate a file upload possibility into the Starter's Kit Example? It does not have to be commons-fileupload...

      Why doesn't jBPM/Hibernate like the ExtensionFilter?

      Any help would be highly appreciated.

      Johannes

        • 1. Re: LazyInitializationException with ExtensionsFilter
          kukeltje

          jbpm itself has a path in the web.xml it says /faces/*

          Besides that, the jBPM context filter should also do its work. Turn on debug logging of org.jbpm and see if the context is not loaded while saving.... What I mean is that on a post from JSF the jBPMContextFilter SHOULD be triggered.

          Besides that, if you realy want to change/adapt things. I recommend using the source and not use/extend the starterkit. It is great for a quick demo, but after that, using the source is better.