Synergy with OpenXava

View: New views
16 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Re: Lazy Fetches

by Alejandro Scandroli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I wasn't talking about 1.2, I was talking about doing a minor update
over 1.1.1, releasing 1.1.2 with a patch for your issues.

Ahhhh yes, I saw that with security, the problem is in the order of
the filters in the web.xml file.

Try adding an "hibernateFilter" filter-mapping before the "Acegi
Filter Chain Proxy" filter-mapping

    <!-- Added for Acegi support. -->
    <filter-mapping>
        <filter-name>hibernateFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>Acegi Filter Chain Proxy</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <!--  Ended added for Acegi support. -->


Anyway, this could create another issue, it depends on how do you
manage the load/unload of your current user.
But let's deal with one problem at a time.
Try the above and let me know how it goes.

Alejandro.

--
Alejandro Scandroli - http://weblog.amneris.es/
Amneris: We build process-driven web applications.
http://www.amneris.es


On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx <superoverdrive@...> wrote:

> Hi Alejandro!
>
>  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1 was still the latest stable release).
>
>  Just do the quick start application using security and replace EAGER by LAZY and login as admin/admin.
>
>  HTTP ERROR: 500
>
>  failed to lazily initialize a collection of role: sample.User.roles, no session or session was closed
>
>  RequestURI=/j_acegi_security_check
>
>  Powered by Jetty://
>
>
>
>  Tobias
>
>  -------- Original-Nachricht --------
>  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
>  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
>
> > An: users@...
>  > Betreff: Re: [trails-users] Lazy Fetches
>
>
>
>  > Hi Tobias
>  >
>  > As long as I know Trails doesn't force you to use EAGER fetches.
>  > Can you give me more details about what problems are you experiencing?
>  > I did a little test setting Car's Make and Model properties to LAZY,
>  > and I didn't get any exceptions.
>  > There is no problem in releasing a 1.1.2 version if we found what the
>  > problem is.
>  >
>  >
>  > Alejandro.
>  >
>  >
>  > --
>  > Alejandro Scandroli - http://weblog.amneris.es/
>  > Amneris: We build process-driven web applications.
>  > http://www.amneris.es
>  >
>  >
>  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx <superoverdrive@...>
>  > wrote:
>  > > Would it be possible to support Lazy Fetches in trails 1.1? (an update?)
>  > >  Or would those changes take too long so the time is better invested in
>  > working on trails 1.2 ?
>  > >
>  > >
>  > >  ---------------------------------------------------------------------
>  > >  To unsubscribe from this list, please visit:
>  > >
>  > >     http://xircles.codehaus.org/manage_email
>  > >
>  > >
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe from this list, please visit:
>  >
>  >     http://xircles.codehaus.org/manage_email
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Toby78 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The filter order didnt help, I'm afraid...still the same.

-------- Original-Nachricht --------
> Datum: Wed, 30 Apr 2008 10:41:11 +0200
> Von: "Alejandro Scandroli" <alejandroscandroli@...>
> An: users@...
> Betreff: Re: [trails-users] Lazy Fetches

> I wasn't talking about 1.2, I was talking about doing a minor update
> over 1.1.1, releasing 1.1.2 with a patch for your issues.
>
> Ahhhh yes, I saw that with security, the problem is in the order of
> the filters in the web.xml file.
>
> Try adding an "hibernateFilter" filter-mapping before the "Acegi
> Filter Chain Proxy" filter-mapping
>
>     <!-- Added for Acegi support. -->
>     <filter-mapping>
>         <filter-name>hibernateFilter</filter-name>
>         <url-pattern>/*</url-pattern>
>     </filter-mapping>
>
>     <filter-mapping>
>         <filter-name>Acegi Filter Chain Proxy</filter-name>
>         <url-pattern>/*</url-pattern>
>     </filter-mapping>
>     <!--  Ended added for Acegi support. -->
>
>
> Anyway, this could create another issue, it depends on how do you
> manage the load/unload of your current user.
> But let's deal with one problem at a time.
> Try the above and let me know how it goes.
>
> Alejandro.
>
> --
> Alejandro Scandroli - http://weblog.amneris.es/
> Amneris: We build process-driven web applications.
> http://www.amneris.es
>
>
> On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx <superoverdrive@...>
> wrote:
> > Hi Alejandro!
> >
> >  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1 was still
> the latest stable release).
> >
> >  Just do the quick start application using security and replace EAGER by
> LAZY and login as admin/admin.
> >
> >  HTTP ERROR: 500
> >
> >  failed to lazily initialize a collection of role: sample.User.roles, no
> session or session was closed
> >
> >  RequestURI=/j_acegi_security_check
> >
> >  Powered by Jetty://
> >
> >
> >
> >  Tobias
> >
> >  -------- Original-Nachricht --------
> >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> >
> > > An: users@...
> >  > Betreff: Re: [trails-users] Lazy Fetches
> >
> >
> >
> >  > Hi Tobias
> >  >
> >  > As long as I know Trails doesn't force you to use EAGER fetches.
> >  > Can you give me more details about what problems are you
> experiencing?
> >  > I did a little test setting Car's Make and Model properties to LAZY,
> >  > and I didn't get any exceptions.
> >  > There is no problem in releasing a 1.1.2 version if we found what the
> >  > problem is.
> >  >
> >  >
> >  > Alejandro.
> >  >
> >  >
> >  > --
> >  > Alejandro Scandroli - http://weblog.amneris.es/
> >  > Amneris: We build process-driven web applications.
> >  > http://www.amneris.es
> >  >
> >  >
> >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx <superoverdrive@...>
> >  > wrote:
> >  > > Would it be possible to support Lazy Fetches in trails 1.1? (an
> update?)
> >  > >  Or would those changes take too long so the time is better
> invested in
> >  > working on trails 1.2 ?
> >  > >
> >  > >
> >  > >
> ---------------------------------------------------------------------
> >  > >  To unsubscribe from this list, please visit:
> >  > >
> >  > >     http://xircles.codehaus.org/manage_email
> >  > >
> >  > >
> >  > >
> >  >
> >  > ---------------------------------------------------------------------
> >  > To unsubscribe from this list, please visit:
> >  >
> >  >     http://xircles.codehaus.org/manage_email
> >  >
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: Lazy Fetches

by nhhockeyplayer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thats the detached collection bug

Best regards
Ken in nashua



> Date: Wed, 30 Apr 2008 10:26:04 +0200
> From: superoverdrive@...
> To: users@...
> Subject: Re: [trails-users] Lazy Fetches
>
> Hi Alejandro!
>
> I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1 was still the latest stable release).
>
> Just do the quick start application using security and replace EAGER by LAZY and login as admin/admin.
>
> HTTP ERROR: 500
>
> failed to lazily initialize a collection of role: sample.User.roles, no session or session was closed
>
> RequestURI=/j_acegi_security_check
>
> Powered by Jetty://
>
>
>
> Tobias
>
> -------- Original-Nachricht --------
> > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > An: users@...
> > Betreff: Re: [trails-users] Lazy Fetches
>
> > Hi Tobias
> >
> > As long as I know Trails doesn't force you to use EAGER fetches.
> > Can you give me more details about what problems are you experiencing?
> > I did a little test setting Car's Make and Model properties to LAZY,
> > and I didn't get any exceptions.
> > There is no problem in releasing a 1.1.2 version if we found what the
> > problem is.
> >
> >
> > Alejandro.
> >
> >
> > --
> > Alejandro Scandroli - http://weblog.amneris.es/
> > Amneris: We build process-driven web applications.
> > http://www.amneris.es
> >
> >
> > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx <superoverdrive@...>
> > wrote:
> > > Would it be possible to support Lazy Fetches in trails 1.1? (an update?)
> > > Or would those changes take too long so the time is better invested in
> > working on trails 1.2 ?
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe from this list, please visit:
> > >
> > > http://xircles.codehaus.org/manage_email
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> > http://xircles.codehaus.org/manage_email
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>


Spell a grand slam in this game where word skill meets World Series. Get in the game.
Best regards
Ken in nashua

Re: Lazy Fetches

by Alejandro Scandroli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobias,

I tested it just now.
I created a 1.1.1 secure project, changed the roles fetch
configuration from EAGER to LAZY and reproduced the exception.
Then I changed the filters order as indicated and it worked.

Are you sure it's the same exception?
Can you send me a larger stack trace log?

--
Alejandro Scandroli - http://weblog.amneris.es/
Amneris: We build process-driven web applications.
http://www.amneris.es



On Wed, Apr 30, 2008 at 10:49 AM, Tobias Marx <superoverdrive@...> wrote:

> The filter order didnt help, I'm afraid...still the same.
>
>  -------- Original-Nachricht --------
>  > Datum: Wed, 30 Apr 2008 10:41:11 +0200
>
>
> > Von: "Alejandro Scandroli" <alejandroscandroli@...>
>  > An: users@...
>  > Betreff: Re: [trails-users] Lazy Fetches
>
>  > I wasn't talking about 1.2, I was talking about doing a minor update
>  > over 1.1.1, releasing 1.1.2 with a patch for your issues.
>  >
>  > Ahhhh yes, I saw that with security, the problem is in the order of
>  > the filters in the web.xml file.
>  >
>  > Try adding an "hibernateFilter" filter-mapping before the "Acegi
>  > Filter Chain Proxy" filter-mapping
>  >
>  >     <!-- Added for Acegi support. -->
>  >     <filter-mapping>
>  >         <filter-name>hibernateFilter</filter-name>
>  >         <url-pattern>/*</url-pattern>
>  >     </filter-mapping>
>  >
>  >     <filter-mapping>
>  >         <filter-name>Acegi Filter Chain Proxy</filter-name>
>  >         <url-pattern>/*</url-pattern>
>  >     </filter-mapping>
>  >     <!--  Ended added for Acegi support. -->
>  >
>  >
>  > Anyway, this could create another issue, it depends on how do you
>  > manage the load/unload of your current user.
>  > But let's deal with one problem at a time.
>  > Try the above and let me know how it goes.
>  >
>  > Alejandro.
>  >
>  > --
>  > Alejandro Scandroli - http://weblog.amneris.es/
>  > Amneris: We build process-driven web applications.
>  > http://www.amneris.es
>  >
>  >
>  > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx <superoverdrive@...>
>  > wrote:
>  > > Hi Alejandro!
>  > >
>  > >  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1 was still
>  > the latest stable release).
>  > >
>  > >  Just do the quick start application using security and replace EAGER by
>  > LAZY and login as admin/admin.
>  > >
>  > >  HTTP ERROR: 500
>  > >
>  > >  failed to lazily initialize a collection of role: sample.User.roles, no
>  > session or session was closed
>  > >
>  > >  RequestURI=/j_acegi_security_check
>  > >
>  > >  Powered by Jetty://
>  > >
>  > >
>  > >
>  > >  Tobias
>  > >
>  > >  -------- Original-Nachricht --------
>  > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
>  > >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
>  > >
>  > > > An: users@...
>  > >  > Betreff: Re: [trails-users] Lazy Fetches
>  > >
>  > >
>  > >
>  > >  > Hi Tobias
>  > >  >
>  > >  > As long as I know Trails doesn't force you to use EAGER fetches.
>  > >  > Can you give me more details about what problems are you
>  > experiencing?
>  > >  > I did a little test setting Car's Make and Model properties to LAZY,
>  > >  > and I didn't get any exceptions.
>  > >  > There is no problem in releasing a 1.1.2 version if we found what the
>  > >  > problem is.
>  > >  >
>  > >  >
>  > >  > Alejandro.
>  > >  >
>  > >  >
>  > >  > --
>  > >  > Alejandro Scandroli - http://weblog.amneris.es/
>  > >  > Amneris: We build process-driven web applications.
>  > >  > http://www.amneris.es
>  > >  >
>  > >  >
>  > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx <superoverdrive@...>
>  > >  > wrote:
>  > >  > > Would it be possible to support Lazy Fetches in trails 1.1? (an
>  > update?)
>  > >  > >  Or would those changes take too long so the time is better
>  > invested in
>  > >  > working on trails 1.2 ?
>  > >  > >
>  > >  > >
>  > >  > >
>  > ---------------------------------------------------------------------
>  > >  > >  To unsubscribe from this list, please visit:
>  > >  > >
>  > >  > >     http://xircles.codehaus.org/manage_email
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  > To unsubscribe from this list, please visit:
>  > >  >
>  > >  >     http://xircles.codehaus.org/manage_email
>  > >  >
>  > >
>  > >  ---------------------------------------------------------------------
>  > >  To unsubscribe from this list, please visit:
>  > >
>  > >     http://xircles.codehaus.org/manage_email
>  > >
>  > >
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe from this list, please visit:
>  >
>  >     http://xircles.codehaus.org/manage_email
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Toby78 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My web.xml looks like that:

        <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>
                        classpath:applicationContext.xml
                        classpath:acegi-security.xml
                        classpath:applicationContext-seedData.xml
                </param-value>
        </context-param>

        <!-- Spring Open Session In View Pattern filter -->
        <filter>
                <filter-name>hibernateFilter</filter-name>
                <filter-class>
                        org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
                </filter-class>
        </filter>


        <!-- Added for Acegi support. -->
        <filter>
                <filter-name>Acegi Filter Chain Proxy</filter-name>
                <filter-class>
                        org.acegisecurity.util.FilterToBeanProxy
                </filter-class>
                <init-param>
                        <param-name>targetClass</param-name>
                        <param-value>
                                org.acegisecurity.util.FilterChainProxy
                        </param-value>
                </init-param>
        </filter>
        <!-- Ended added for Acegi support. -->

        <filter>
                <filter-name>redirect</filter-name>
                <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
        </filter>

       
        <!-- Added for Acegi support. -->
        <filter-mapping>
                <filter-name>Acegi Filter Chain Proxy</filter-name>
                <url-pattern>/*</url-pattern>
        </filter-mapping>
        <!--  Ended added for Acegi support. -->

        <filter-mapping>
                <filter-name>redirect</filter-name>
                <url-pattern>/</url-pattern>
        </filter-mapping>

        <!-- Spring/Hibernate filter mappings -->
        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>/app/*</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>/app</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>*.page</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>*.direct</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>*.sdirect</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>/assets/*</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>*.svc</url-pattern>
        </filter-mapping>

        <listener>
                <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <servlet>
                <servlet-name>trails</servlet-name>
                <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>/app</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>*.page</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>*.direct</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>*.sdirect</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>/assets/*</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>*.svc</url-pattern>
        </servlet-mapping>


The stack trace:

10:33:24.875 WARN!! [SocketListener0-0] org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590) >11> /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.company.User.roles, no session or session was closed
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
        at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
        at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
        at org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
        at java.lang.String.valueOf(String.java:2615)
        at java.lang.StringBuilder.append(StringBuilder.java:116)
        at com.company.User.getAuthorities(User.java:209)
        at org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
        at org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
        at org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
        at org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
        at org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
        at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
        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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
        at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
        at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
        at org.mortbay.http.HttpServer.service(HttpServer.java:896)
        at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
        at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
        at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
        at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

This happens on the default applications (quick start + security) when using LAZY fetches on the role and trying to login as admin/admin.


-------- Original-Nachricht --------
> Datum: Wed, 30 Apr 2008 10:41:11 +0200
> Von: "Alejandro Scandroli" <alejandroscandroli@...>
> An: users@...
> Betreff: Re: [trails-users] Lazy Fetches

> I wasn't talking about 1.2, I was talking about doing a minor update
> over 1.1.1, releasing 1.1.2 with a patch for your issues.
>
> Ahhhh yes, I saw that with security, the problem is in the order of
> the filters in the web.xml file.
>
> Try adding an "hibernateFilter" filter-mapping before the "Acegi
> Filter Chain Proxy" filter-mapping
>
>     <!-- Added for Acegi support. -->
>     <filter-mapping>
>         <filter-name>hibernateFilter</filter-name>
>         <url-pattern>/*</url-pattern>
>     </filter-mapping>
>
>     <filter-mapping>
>         <filter-name>Acegi Filter Chain Proxy</filter-name>
>         <url-pattern>/*</url-pattern>
>     </filter-mapping>
>     <!--  Ended added for Acegi support. -->
>
>
> Anyway, this could create another issue, it depends on how do you
> manage the load/unload of your current user.
> But let's deal with one problem at a time.
> Try the above and let me know how it goes.
>
> Alejandro.
>
> --
> Alejandro Scandroli - http://weblog.amneris.es/
> Amneris: We build process-driven web applications.
> http://www.amneris.es
>
>
> On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx <superoverdrive@...>
> wrote:
> > Hi Alejandro!
> >
> >  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1 was still
> the latest stable release).
> >
> >  Just do the quick start application using security and replace EAGER by
> LAZY and login as admin/admin.
> >
> >  HTTP ERROR: 500
> >
> >  failed to lazily initialize a collection of role: sample.User.roles, no
> session or session was closed
> >
> >  RequestURI=/j_acegi_security_check
> >
> >  Powered by Jetty://
> >
> >
> >
> >  Tobias
> >
> >  -------- Original-Nachricht --------
> >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> >
> > > An: users@...
> >  > Betreff: Re: [trails-users] Lazy Fetches
> >
> >
> >
> >  > Hi Tobias
> >  >
> >  > As long as I know Trails doesn't force you to use EAGER fetches.
> >  > Can you give me more details about what problems are you
> experiencing?
> >  > I did a little test setting Car's Make and Model properties to LAZY,
> >  > and I didn't get any exceptions.
> >  > There is no problem in releasing a 1.1.2 version if we found what the
> >  > problem is.
> >  >
> >  >
> >  > Alejandro.
> >  >
> >  >
> >  > --
> >  > Alejandro Scandroli - http://weblog.amneris.es/
> >  > Amneris: We build process-driven web applications.
> >  > http://www.amneris.es
> >  >
> >  >
> >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx <superoverdrive@...>
> >  > wrote:
> >  > > Would it be possible to support Lazy Fetches in trails 1.1? (an
> update?)
> >  > >  Or would those changes take too long so the time is better
> invested in
> >  > working on trails 1.2 ?
> >  > >
> >  > >
> >  > >
> ---------------------------------------------------------------------
> >  > >  To unsubscribe from this list, please visit:
> >  > >
> >  > >     http://xircles.codehaus.org/manage_email
> >  > >
> >  > >
> >  > >
> >  >
> >  > ---------------------------------------------------------------------
> >  > To unsubscribe from this list, please visit:
> >  >
> >  >     http://xircles.codehaus.org/manage_email
> >  >
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Alejandro Scandroli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobias,

It has to be the filter-mapping order, I know that the default web.xml
(in quick start + security) has this problem.
Please try again adding the hibernateFilter filter-mapping before the
"Acegi Filter Chain Proxy", it should look like this:

   <!-- Added for Acegi support. -->
   <filter-mapping>
       <filter-name>hibernateFilter</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>

   <filter-mapping>
       <filter-name>Acegi Filter Chain Proxy</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>
   <!--  Ended added for Acegi support. -->


Alejandro.


On Mon, May 5, 2008 at 10:37 AM, Tobias Marx <superoverdrive@...> wrote:

> My web.xml looks like that:
>
>         <context-param>
>                 <param-name>contextConfigLocation</param-name>
>                 <param-value>
>                         classpath:applicationContext.xml
>                         classpath:acegi-security.xml
>                         classpath:applicationContext-seedData.xml
>                 </param-value>
>         </context-param>
>
>         <!-- Spring Open Session In View Pattern filter -->
>         <filter>
>
>                 <filter-name>hibernateFilter</filter-name>
>                 <filter-class>
>                         org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
>                 </filter-class>
>         </filter>
>
>
>
>         <!-- Added for Acegi support. -->
>         <filter>
>
>                 <filter-name>Acegi Filter Chain Proxy</filter-name>
>                 <filter-class>
>                         org.acegisecurity.util.FilterToBeanProxy
>                 </filter-class>
>                 <init-param>
>                         <param-name>targetClass</param-name>
>                         <param-value>
>                                 org.acegisecurity.util.FilterChainProxy
>                         </param-value>
>                 </init-param>
>         </filter>
>
>         <!-- Ended added for Acegi support. -->
>
>         <filter>
>                 <filter-name>redirect</filter-name>
>                 <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
>         </filter>
>
>
>
>         <!-- Added for Acegi support. -->
>         <filter-mapping>
>
>                 <filter-name>Acegi Filter Chain Proxy</filter-name>
>                 <url-pattern>/*</url-pattern>
>         </filter-mapping>
>         <!--  Ended added for Acegi support. -->
>
>         <filter-mapping>
>                 <filter-name>redirect</filter-name>
>
>                 <url-pattern>/</url-pattern>
>         </filter-mapping>
>
>         <!-- Spring/Hibernate filter mappings -->
>
>         <filter-mapping>
>                 <filter-name>hibernateFilter</filter-name>
>                 <url-pattern>/app/*</url-pattern>
>
>         </filter-mapping>
>
>         <filter-mapping>
>                 <filter-name>hibernateFilter</filter-name>
>                 <url-pattern>/app</url-pattern>
>         </filter-mapping>
>
>         <filter-mapping>
>
>                 <filter-name>hibernateFilter</filter-name>
>                 <url-pattern>*.page</url-pattern>
>         </filter-mapping>
>
>         <filter-mapping>
>
>                 <filter-name>hibernateFilter</filter-name>
>                 <url-pattern>*.direct</url-pattern>
>         </filter-mapping>
>
>         <filter-mapping>
>
>                 <filter-name>hibernateFilter</filter-name>
>                 <url-pattern>*.sdirect</url-pattern>
>
>         </filter-mapping>
>
>         <filter-mapping>
>                 <filter-name>hibernateFilter</filter-name>
>                 <url-pattern>/assets/*</url-pattern>
>
>         </filter-mapping>
>
>         <filter-mapping>
>                 <filter-name>hibernateFilter</filter-name>
>                 <url-pattern>*.svc</url-pattern>
>         </filter-mapping>
>
>         <listener>
>                 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>         </listener>
>         <servlet>
>                 <servlet-name>trails</servlet-name>
>                 <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
>                 <load-on-startup>1</load-on-startup>
>         </servlet>
>
>         <servlet-mapping>
>                 <servlet-name>trails</servlet-name>
>                 <url-pattern>/app</url-pattern>
>         </servlet-mapping>
>
>         <servlet-mapping>
>                 <servlet-name>trails</servlet-name>
>                 <url-pattern>*.page</url-pattern>
>         </servlet-mapping>
>
>         <servlet-mapping>
>                 <servlet-name>trails</servlet-name>
>                 <url-pattern>*.direct</url-pattern>
>         </servlet-mapping>
>
>         <servlet-mapping>
>                 <servlet-name>trails</servlet-name>
>                 <url-pattern>*.sdirect</url-pattern>
>         </servlet-mapping>
>
>         <servlet-mapping>
>                 <servlet-name>trails</servlet-name>
>                 <url-pattern>/assets/*</url-pattern>
>         </servlet-mapping>
>
>         <servlet-mapping>
>                 <servlet-name>trails</servlet-name>
>                 <url-pattern>*.svc</url-pattern>
>         </servlet-mapping>
>
>
>  The stack trace:
>
>  10:33:24.875 WARN!! [SocketListener0-0] org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590) >11> /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
>  org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.company.User.roles, no session or session was closed
>         at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
>         at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
>         at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
>         at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
>         at org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
>         at java.lang.String.valueOf(String.java:2615)
>         at java.lang.StringBuilder.append(StringBuilder.java:116)
>         at com.company.User.getAuthorities(User.java:209)
>         at org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
>         at org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
>         at org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
>         at org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
>         at org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
>         at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
>         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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
>         at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
>         at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
>         at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>         at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
>         at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
>         at org.mortbay.http.HttpServer.service(HttpServer.java:896)
>         at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
>         at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
>         at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
>         at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
>         at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
>         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>
>  This happens on the default applications (quick start + security) when using LAZY fetches on the role and trying to login as admin/admin.
>
>
>  -------- Original-Nachricht --------
>  > Datum: Wed, 30 Apr 2008 10:41:11 +0200
>
>
> > Von: "Alejandro Scandroli" <alejandroscandroli@...>
>  > An: users@...
>  > Betreff: Re: [trails-users] Lazy Fetches
>
>  > I wasn't talking about 1.2, I was talking about doing a minor update
>  > over 1.1.1, releasing 1.1.2 with a patch for your issues.
>  >
>  > Ahhhh yes, I saw that with security, the problem is in the order of
>  > the filters in the web.xml file.
>  >
>  > Try adding an "hibernateFilter" filter-mapping before the "Acegi
>  > Filter Chain Proxy" filter-mapping
>  >
>  >     <!-- Added for Acegi support. -->
>  >     <filter-mapping>
>  >         <filter-name>hibernateFilter</filter-name>
>  >         <url-pattern>/*</url-pattern>
>  >     </filter-mapping>
>  >
>  >     <filter-mapping>
>  >         <filter-name>Acegi Filter Chain Proxy</filter-name>
>  >         <url-pattern>/*</url-pattern>
>  >     </filter-mapping>
>  >     <!--  Ended added for Acegi support. -->
>  >
>  >
>  > Anyway, this could create another issue, it depends on how do you
>  > manage the load/unload of your current user.
>  > But let's deal with one problem at a time.
>  > Try the above and let me know how it goes.
>  >
>  > Alejandro.
>  >
>  > --
>  > Alejandro Scandroli - http://weblog.amneris.es/
>  > Amneris: We build process-driven web applications.
>  > http://www.amneris.es
>  >
>  >
>  > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx <superoverdrive@...>
>  > wrote:
>  > > Hi Alejandro!
>  > >
>  > >  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1 was still
>  > the latest stable release).
>  > >
>  > >  Just do the quick start application using security and replace EAGER by
>  > LAZY and login as admin/admin.
>  > >
>  > >  HTTP ERROR: 500
>  > >
>  > >  failed to lazily initialize a collection of role: sample.User.roles, no
>  > session or session was closed
>  > >
>  > >  RequestURI=/j_acegi_security_check
>  > >
>  > >  Powered by Jetty://
>  > >
>  > >
>  > >
>  > >  Tobias
>  > >
>  > >  -------- Original-Nachricht --------
>  > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
>  > >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
>  > >
>  > > > An: users@...
>  > >  > Betreff: Re: [trails-users] Lazy Fetches
>  > >
>  > >
>  > >
>  > >  > Hi Tobias
>  > >  >
>  > >  > As long as I know Trails doesn't force you to use EAGER fetches.
>  > >  > Can you give me more details about what problems are you
>  > experiencing?
>  > >  > I did a little test setting Car's Make and Model properties to LAZY,
>  > >  > and I didn't get any exceptions.
>  > >  > There is no problem in releasing a 1.1.2 version if we found what the
>  > >  > problem is.
>  > >  >
>  > >  >
>  > >  > Alejandro.
>  > >  >
>  > >  >
>  > >  > --
>  > >  > Alejandro Scandroli - http://weblog.amneris.es/
>  > >  > Amneris: We build process-driven web applications.
>  > >  > http://www.amneris.es
>  > >  >
>  > >  >
>  > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx <superoverdrive@...>
>  > >  > wrote:
>  > >  > > Would it be possible to support Lazy Fetches in trails 1.1? (an
>  > update?)
>  > >  > >  Or would those changes take too long so the time is better
>  > invested in
>  > >  > working on trails 1.2 ?
>  > >  > >
>  > >  > >
>  > >  > >
>  > ---------------------------------------------------------------------
>  > >  > >  To unsubscribe from this list, please visit:
>  > >  > >
>  > >  > >     http://xircles.codehaus.org/manage_email
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  > To unsubscribe from this list, please visit:
>  > >  >
>  > >  >     http://xircles.codehaus.org/manage_email
>  > >  >
>  > >
>  > >  ---------------------------------------------------------------------
>  > >  To unsubscribe from this list, please visit:
>  > >
>  > >     http://xircles.codehaus.org/manage_email
>  > >
>  > >
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe from this list, please visit:
>  >
>  >     http://xircles.codehaus.org/manage_email
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Toby78 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I mean this one, sorry (wrong file):


        <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>
                        classpath:applicationContext.xml
                        classpath:acegi-security.xml
                        classpath:applicationContext-seedData.xml
                </param-value>
        </context-param>

        <!-- Spring Open Session In View Pattern filter -->
        <filter>
                <filter-name>hibernateFilter</filter-name>
                <filter-class>
                        org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
                </filter-class>
        </filter>


        <!-- Added for Acegi support. -->
        <filter>
                <filter-name>Acegi Filter Chain Proxy</filter-name>
                <filter-class>
                        org.acegisecurity.util.FilterToBeanProxy
                </filter-class>
                <init-param>
                        <param-name>targetClass</param-name>
                        <param-value>
                                org.acegisecurity.util.FilterChainProxy
                        </param-value>
                </init-param>
        </filter>
        <!-- Ended added for Acegi support. -->

        <filter>
                <filter-name>redirect</filter-name>
                <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
        </filter>

        <filter-mapping>
                <filter-name>redirect</filter-name>
                <url-pattern>/</url-pattern>
        </filter-mapping>


        <!-- Spring/Hibernate filter mappings -->
        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>/app/*</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>/app</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>*.page</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>*.direct</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>*.sdirect</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>/assets/*</url-pattern>
        </filter-mapping>

        <filter-mapping>
                <filter-name>hibernateFilter</filter-name>
                <url-pattern>*.svc</url-pattern>
        </filter-mapping>

        <!-- Added for Acegi support. -->
        <filter-mapping>
                <filter-name>Acegi Filter Chain Proxy</filter-name>
                <url-pattern>/*</url-pattern>
        </filter-mapping>
        <!--  Ended added for Acegi support. -->


        <listener>
                <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <servlet>
                <servlet-name>trails</servlet-name>
                <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>/app</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>*.page</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>*.direct</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>*.sdirect</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>/assets/*</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>trails</servlet-name>
                <url-pattern>*.svc</url-pattern>
        </servlet-mapping>



-------- Original-Nachricht --------
> Datum: Mon, 05 May 2008 10:37:06 +0200
> Von: "Tobias Marx" <superoverdrive@...>
> An: users@...
> Betreff: Re: [trails-users] Lazy Fetches

> My web.xml looks like that:
>
> <context-param>
> <param-name>contextConfigLocation</param-name>
> <param-value>
> classpath:applicationContext.xml
> classpath:acegi-security.xml
> classpath:applicationContext-seedData.xml
> </param-value>
> </context-param>
>
> <!-- Spring Open Session In View Pattern filter -->
> <filter>
> <filter-name>hibernateFilter</filter-name>
> <filter-class>
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> </filter-class>
> </filter>
>
>
> <!-- Added for Acegi support. -->
> <filter>
> <filter-name>Acegi Filter Chain Proxy</filter-name>
> <filter-class>
> org.acegisecurity.util.FilterToBeanProxy
> </filter-class>
> <init-param>
> <param-name>targetClass</param-name>
> <param-value>
> org.acegisecurity.util.FilterChainProxy
> </param-value>
> </init-param>
> </filter>
> <!-- Ended added for Acegi support. -->
>
> <filter>
> <filter-name>redirect</filter-name>
> <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
> </filter>
>
>
> <!-- Added for Acegi support. -->
> <filter-mapping>
> <filter-name>Acegi Filter Chain Proxy</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <!--  Ended added for Acegi support. -->
>
> <filter-mapping>
> <filter-name>redirect</filter-name>
> <url-pattern>/</url-pattern>
> </filter-mapping>
>
> <!-- Spring/Hibernate filter mappings -->
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>/app/*</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>/app</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>*.page</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>*.direct</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>*.sdirect</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>/assets/*</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>*.svc</url-pattern>
> </filter-mapping>
>
> <listener>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> </listener>
> <servlet>
> <servlet-name>trails</servlet-name>
> <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>/app</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>*.page</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>*.direct</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>*.sdirect</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>/assets/*</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>*.svc</url-pattern>
> </servlet-mapping>
>
>
> The stack trace:
>
> 10:33:24.875 WARN!! [SocketListener0-0]
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590) >11>
> /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
> org.hibernate.LazyInitializationException: failed to lazily initialize a
> collection of role: com.company.User.roles, no session or session was closed
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> at
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> at
> org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
> at
> org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
> at java.lang.String.valueOf(String.java:2615)
> at java.lang.StringBuilder.append(StringBuilder.java:116)
> at com.company.User.getAuthorities(User.java:209)
> at
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
> at
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
> at
> org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
> at
> org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
> at
> org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
> at
> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
> 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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> at
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> at
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> at org.mortbay.http.HttpServer.service(HttpServer.java:896)
> at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>
> This happens on the default applications (quick start + security) when
> using LAZY fetches on the role and trying to login as admin/admin.
>
>
> -------- Original-Nachricht --------
> > Datum: Wed, 30 Apr 2008 10:41:11 +0200
> > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > An: users@...
> > Betreff: Re: [trails-users] Lazy Fetches
>
> > I wasn't talking about 1.2, I was talking about doing a minor update
> > over 1.1.1, releasing 1.1.2 with a patch for your issues.
> >
> > Ahhhh yes, I saw that with security, the problem is in the order of
> > the filters in the web.xml file.
> >
> > Try adding an "hibernateFilter" filter-mapping before the "Acegi
> > Filter Chain Proxy" filter-mapping
> >
> >     <!-- Added for Acegi support. -->
> >     <filter-mapping>
> >         <filter-name>hibernateFilter</filter-name>
> >         <url-pattern>/*</url-pattern>
> >     </filter-mapping>
> >
> >     <filter-mapping>
> >         <filter-name>Acegi Filter Chain Proxy</filter-name>
> >         <url-pattern>/*</url-pattern>
> >     </filter-mapping>
> >     <!--  Ended added for Acegi support. -->
> >
> >
> > Anyway, this could create another issue, it depends on how do you
> > manage the load/unload of your current user.
> > But let's deal with one problem at a time.
> > Try the above and let me know how it goes.
> >
> > Alejandro.
> >
> > --
> > Alejandro Scandroli - http://weblog.amneris.es/
> > Amneris: We build process-driven web applications.
> > http://www.amneris.es
> >
> >
> > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx <superoverdrive@...>
> > wrote:
> > > Hi Alejandro!
> > >
> > >  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1 was
> still
> > the latest stable release).
> > >
> > >  Just do the quick start application using security and replace EAGER
> by
> > LAZY and login as admin/admin.
> > >
> > >  HTTP ERROR: 500
> > >
> > >  failed to lazily initialize a collection of role: sample.User.roles,
> no
> > session or session was closed
> > >
> > >  RequestURI=/j_acegi_security_check
> > >
> > >  Powered by Jetty://
> > >
> > >
> > >
> > >  Tobias
> > >
> > >  -------- Original-Nachricht --------
> > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> > >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > >
> > > > An: users@...
> > >  > Betreff: Re: [trails-users] Lazy Fetches
> > >
> > >
> > >
> > >  > Hi Tobias
> > >  >
> > >  > As long as I know Trails doesn't force you to use EAGER fetches.
> > >  > Can you give me more details about what problems are you
> > experiencing?
> > >  > I did a little test setting Car's Make and Model properties to
> LAZY,
> > >  > and I didn't get any exceptions.
> > >  > There is no problem in releasing a 1.1.2 version if we found what
> the
> > >  > problem is.
> > >  >
> > >  >
> > >  > Alejandro.
> > >  >
> > >  >
> > >  > --
> > >  > Alejandro Scandroli - http://weblog.amneris.es/
> > >  > Amneris: We build process-driven web applications.
> > >  > http://www.amneris.es
> > >  >
> > >  >
> > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx
> <superoverdrive@...>
> > >  > wrote:
> > >  > > Would it be possible to support Lazy Fetches in trails 1.1? (an
> > update?)
> > >  > >  Or would those changes take too long so the time is better
> > invested in
> > >  > working on trails 1.2 ?
> > >  > >
> > >  > >
> > >  > >
> > ---------------------------------------------------------------------
> > >  > >  To unsubscribe from this list, please visit:
> > >  > >
> > >  > >     http://xircles.codehaus.org/manage_email
> > >  > >
> > >  > >
> > >  > >
> > >  >
> > >  >
> ---------------------------------------------------------------------
> > >  > To unsubscribe from this list, please visit:
> > >  >
> > >  >     http://xircles.codehaus.org/manage_email
> > >  >
> > >
> > >  ---------------------------------------------------------------------
> > >  To unsubscribe from this list, please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Toby78 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If I change the hibernate filter to /* instead of /app/* like in your example, I am forwarded to:

http://localhost:8080/assets/static/tapestry/core.js

when I try to login.....

-------- Original-Nachricht --------
> Datum: Mon, 05 May 2008 10:37:06 +0200
> Von: "Tobias Marx" <superoverdrive@...>
> An: users@...
> Betreff: Re: [trails-users] Lazy Fetches

> My web.xml looks like that:
>
> <context-param>
> <param-name>contextConfigLocation</param-name>
> <param-value>
> classpath:applicationContext.xml
> classpath:acegi-security.xml
> classpath:applicationContext-seedData.xml
> </param-value>
> </context-param>
>
> <!-- Spring Open Session In View Pattern filter -->
> <filter>
> <filter-name>hibernateFilter</filter-name>
> <filter-class>
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> </filter-class>
> </filter>
>
>
> <!-- Added for Acegi support. -->
> <filter>
> <filter-name>Acegi Filter Chain Proxy</filter-name>
> <filter-class>
> org.acegisecurity.util.FilterToBeanProxy
> </filter-class>
> <init-param>
> <param-name>targetClass</param-name>
> <param-value>
> org.acegisecurity.util.FilterChainProxy
> </param-value>
> </init-param>
> </filter>
> <!-- Ended added for Acegi support. -->
>
> <filter>
> <filter-name>redirect</filter-name>
> <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
> </filter>
>
>
> <!-- Added for Acegi support. -->
> <filter-mapping>
> <filter-name>Acegi Filter Chain Proxy</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <!--  Ended added for Acegi support. -->
>
> <filter-mapping>
> <filter-name>redirect</filter-name>
> <url-pattern>/</url-pattern>
> </filter-mapping>
>
> <!-- Spring/Hibernate filter mappings -->
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>/app/*</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>/app</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>*.page</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>*.direct</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>*.sdirect</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>/assets/*</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>hibernateFilter</filter-name>
> <url-pattern>*.svc</url-pattern>
> </filter-mapping>
>
> <listener>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> </listener>
> <servlet>
> <servlet-name>trails</servlet-name>
> <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>/app</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>*.page</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>*.direct</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>*.sdirect</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>/assets/*</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>trails</servlet-name>
> <url-pattern>*.svc</url-pattern>
> </servlet-mapping>
>
>
> The stack trace:
>
> 10:33:24.875 WARN!! [SocketListener0-0]
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590) >11>
> /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
> org.hibernate.LazyInitializationException: failed to lazily initialize a
> collection of role: com.company.User.roles, no session or session was closed
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> at
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> at
> org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
> at
> org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
> at java.lang.String.valueOf(String.java:2615)
> at java.lang.StringBuilder.append(StringBuilder.java:116)
> at com.company.User.getAuthorities(User.java:209)
> at
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
> at
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
> at
> org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
> at
> org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
> at
> org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
> at
> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
> 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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> at
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> at
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> at org.mortbay.http.HttpServer.service(HttpServer.java:896)
> at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>
> This happens on the default applications (quick start + security) when
> using LAZY fetches on the role and trying to login as admin/admin.
>
>
> -------- Original-Nachricht --------
> > Datum: Wed, 30 Apr 2008 10:41:11 +0200
> > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > An: users@...
> > Betreff: Re: [trails-users] Lazy Fetches
>
> > I wasn't talking about 1.2, I was talking about doing a minor update
> > over 1.1.1, releasing 1.1.2 with a patch for your issues.
> >
> > Ahhhh yes, I saw that with security, the problem is in the order of
> > the filters in the web.xml file.
> >
> > Try adding an "hibernateFilter" filter-mapping before the "Acegi
> > Filter Chain Proxy" filter-mapping
> >
> >     <!-- Added for Acegi support. -->
> >     <filter-mapping>
> >         <filter-name>hibernateFilter</filter-name>
> >         <url-pattern>/*</url-pattern>
> >     </filter-mapping>
> >
> >     <filter-mapping>
> >         <filter-name>Acegi Filter Chain Proxy</filter-name>
> >         <url-pattern>/*</url-pattern>
> >     </filter-mapping>
> >     <!--  Ended added for Acegi support. -->
> >
> >
> > Anyway, this could create another issue, it depends on how do you
> > manage the load/unload of your current user.
> > But let's deal with one problem at a time.
> > Try the above and let me know how it goes.
> >
> > Alejandro.
> >
> > --
> > Alejandro Scandroli - http://weblog.amneris.es/
> > Amneris: We build process-driven web applications.
> > http://www.amneris.es
> >
> >
> > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx <superoverdrive@...>
> > wrote:
> > > Hi Alejandro!
> > >
> > >  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1 was
> still
> > the latest stable release).
> > >
> > >  Just do the quick start application using security and replace EAGER
> by
> > LAZY and login as admin/admin.
> > >
> > >  HTTP ERROR: 500
> > >
> > >  failed to lazily initialize a collection of role: sample.User.roles,
> no
> > session or session was closed
> > >
> > >  RequestURI=/j_acegi_security_check
> > >
> > >  Powered by Jetty://
> > >
> > >
> > >
> > >  Tobias
> > >
> > >  -------- Original-Nachricht --------
> > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> > >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > >
> > > > An: users@...
> > >  > Betreff: Re: [trails-users] Lazy Fetches
> > >
> > >
> > >
> > >  > Hi Tobias
> > >  >
> > >  > As long as I know Trails doesn't force you to use EAGER fetches.
> > >  > Can you give me more details about what problems are you
> > experiencing?
> > >  > I did a little test setting Car's Make and Model properties to
> LAZY,
> > >  > and I didn't get any exceptions.
> > >  > There is no problem in releasing a 1.1.2 version if we found what
> the
> > >  > problem is.
> > >  >
> > >  >
> > >  > Alejandro.
> > >  >
> > >  >
> > >  > --
> > >  > Alejandro Scandroli - http://weblog.amneris.es/
> > >  > Amneris: We build process-driven web applications.
> > >  > http://www.amneris.es
> > >  >
> > >  >
> > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx
> <superoverdrive@...>
> > >  > wrote:
> > >  > > Would it be possible to support Lazy Fetches in trails 1.1? (an
> > update?)
> > >  > >  Or would those changes take too long so the time is better
> > invested in
> > >  > working on trails 1.2 ?
> > >  > >
> > >  > >
> > >  > >
> > ---------------------------------------------------------------------
> > >  > >  To unsubscribe from this list, please visit:
> > >  > >
> > >  > >     http://xircles.codehaus.org/manage_email
> > >  > >
> > >  > >
> > >  > >
> > >  >
> > >  >
> ---------------------------------------------------------------------
> > >  > To unsubscribe from this list, please visit:
> > >  >
> > >  >     http://xircles.codehaus.org/manage_email
> > >  >
> > >
> > >  ---------------------------------------------------------------------
> > >  To unsubscribe from this list, please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Toby78 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Could you maybe send your web.xml file, just to make sure we have the same ?

-------- Original-Nachricht --------
> Datum: Mon, 05 May 2008 10:57:41 +0200
> Von: "Tobias Marx" <superoverdrive@...>
> An: users@...
> Betreff: Re: [trails-users] Lazy Fetches

> If I change the hibernate filter to /* instead of /app/* like in your
> example, I am forwarded to:
>
> http://localhost:8080/assets/static/tapestry/core.js
>
> when I try to login.....
>
> -------- Original-Nachricht --------
> > Datum: Mon, 05 May 2008 10:37:06 +0200
> > Von: "Tobias Marx" <superoverdrive@...>
> > An: users@...
> > Betreff: Re: [trails-users] Lazy Fetches
>
> > My web.xml looks like that:
> >
> > <context-param>
> > <param-name>contextConfigLocation</param-name>
> > <param-value>
> > classpath:applicationContext.xml
> > classpath:acegi-security.xml
> > classpath:applicationContext-seedData.xml
> > </param-value>
> > </context-param>
> >
> > <!-- Spring Open Session In View Pattern filter -->
> > <filter>
> > <filter-name>hibernateFilter</filter-name>
> > <filter-class>
> > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> > </filter-class>
> > </filter>
> >
> >
> > <!-- Added for Acegi support. -->
> > <filter>
> > <filter-name>Acegi Filter Chain Proxy</filter-name>
> > <filter-class>
> > org.acegisecurity.util.FilterToBeanProxy
> > </filter-class>
> > <init-param>
> > <param-name>targetClass</param-name>
> > <param-value>
> > org.acegisecurity.util.FilterChainProxy
> > </param-value>
> > </init-param>
> > </filter>
> > <!-- Ended added for Acegi support. -->
> >
> > <filter>
> > <filter-name>redirect</filter-name>
> > <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
> > </filter>
> >
> >
> > <!-- Added for Acegi support. -->
> > <filter-mapping>
> > <filter-name>Acegi Filter Chain Proxy</filter-name>
> > <url-pattern>/*</url-pattern>
> > </filter-mapping>
> > <!--  Ended added for Acegi support. -->
> >
> > <filter-mapping>
> > <filter-name>redirect</filter-name>
> > <url-pattern>/</url-pattern>
> > </filter-mapping>
> >
> > <!-- Spring/Hibernate filter mappings -->
> > <filter-mapping>
> > <filter-name>hibernateFilter</filter-name>
> > <url-pattern>/app/*</url-pattern>
> > </filter-mapping>
> >
> > <filter-mapping>
> > <filter-name>hibernateFilter</filter-name>
> > <url-pattern>/app</url-pattern>
> > </filter-mapping>
> >
> > <filter-mapping>
> > <filter-name>hibernateFilter</filter-name>
> > <url-pattern>*.page</url-pattern>
> > </filter-mapping>
> >
> > <filter-mapping>
> > <filter-name>hibernateFilter</filter-name>
> > <url-pattern>*.direct</url-pattern>
> > </filter-mapping>
> >
> > <filter-mapping>
> > <filter-name>hibernateFilter</filter-name>
> > <url-pattern>*.sdirect</url-pattern>
> > </filter-mapping>
> >
> > <filter-mapping>
> > <filter-name>hibernateFilter</filter-name>
> > <url-pattern>/assets/*</url-pattern>
> > </filter-mapping>
> >
> > <filter-mapping>
> > <filter-name>hibernateFilter</filter-name>
> > <url-pattern>*.svc</url-pattern>
> > </filter-mapping>
> >
> > <listener>
> >
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> > </listener>
> > <servlet>
> > <servlet-name>trails</servlet-name>
> >
> <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
> > <load-on-startup>1</load-on-startup>
> > </servlet>
> >
> > <servlet-mapping>
> > <servlet-name>trails</servlet-name>
> > <url-pattern>/app</url-pattern>
> > </servlet-mapping>
> >
> > <servlet-mapping>
> > <servlet-name>trails</servlet-name>
> > <url-pattern>*.page</url-pattern>
> > </servlet-mapping>
> >
> > <servlet-mapping>
> > <servlet-name>trails</servlet-name>
> > <url-pattern>*.direct</url-pattern>
> > </servlet-mapping>
> >
> > <servlet-mapping>
> > <servlet-name>trails</servlet-name>
> > <url-pattern>*.sdirect</url-pattern>
> > </servlet-mapping>
> >
> > <servlet-mapping>
> > <servlet-name>trails</servlet-name>
> > <url-pattern>/assets/*</url-pattern>
> > </servlet-mapping>
> >
> > <servlet-mapping>
> > <servlet-name>trails</servlet-name>
> > <url-pattern>*.svc</url-pattern>
> > </servlet-mapping>
> >
> >
> > The stack trace:
> >
> > 10:33:24.875 WARN!! [SocketListener0-0]
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590)
> >11>
> >
> /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
> > org.hibernate.LazyInitializationException: failed to lazily initialize a
> > collection of role: com.company.User.roles, no session or session was
> closed
> > at
> >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> > at
> >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> > at
> >
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> > at
> >
> org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
> > at
> > org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
> > at java.lang.String.valueOf(String.java:2615)
> > at java.lang.StringBuilder.append(StringBuilder.java:116)
> > at com.company.User.getAuthorities(User.java:209)
> > at
> >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
> > at
> >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
> > at
> >
> org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
> > at
> >
> org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
> > at
> >
> org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
> > at
> >
> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
> > 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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > at
> >
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> > at
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> > at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> > at
> >
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> > at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> > at org.mortbay.http.HttpServer.service(HttpServer.java:896)
> > at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> > at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> > at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> > at
> >
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> > at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> > at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> >
> > This happens on the default applications (quick start + security) when
> > using LAZY fetches on the role and trying to login as admin/admin.
> >
> >
> > -------- Original-Nachricht --------
> > > Datum: Wed, 30 Apr 2008 10:41:11 +0200
> > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > > An: users@...
> > > Betreff: Re: [trails-users] Lazy Fetches
> >
> > > I wasn't talking about 1.2, I was talking about doing a minor update
> > > over 1.1.1, releasing 1.1.2 with a patch for your issues.
> > >
> > > Ahhhh yes, I saw that with security, the problem is in the order of
> > > the filters in the web.xml file.
> > >
> > > Try adding an "hibernateFilter" filter-mapping before the "Acegi
> > > Filter Chain Proxy" filter-mapping
> > >
> > >     <!-- Added for Acegi support. -->
> > >     <filter-mapping>
> > >         <filter-name>hibernateFilter</filter-name>
> > >         <url-pattern>/*</url-pattern>
> > >     </filter-mapping>
> > >
> > >     <filter-mapping>
> > >         <filter-name>Acegi Filter Chain Proxy</filter-name>
> > >         <url-pattern>/*</url-pattern>
> > >     </filter-mapping>
> > >     <!--  Ended added for Acegi support. -->
> > >
> > >
> > > Anyway, this could create another issue, it depends on how do you
> > > manage the load/unload of your current user.
> > > But let's deal with one problem at a time.
> > > Try the above and let me know how it goes.
> > >
> > > Alejandro.
> > >
> > > --
> > > Alejandro Scandroli - http://weblog.amneris.es/
> > > Amneris: We build process-driven web applications.
> > > http://www.amneris.es
> > >
> > >
> > > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx <superoverdrive@...>
> > > wrote:
> > > > Hi Alejandro!
> > > >
> > > >  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1 was
> > still
> > > the latest stable release).
> > > >
> > > >  Just do the quick start application using security and replace
> EAGER
> > by
> > > LAZY and login as admin/admin.
> > > >
> > > >  HTTP ERROR: 500
> > > >
> > > >  failed to lazily initialize a collection of role:
> sample.User.roles,
> > no
> > > session or session was closed
> > > >
> > > >  RequestURI=/j_acegi_security_check
> > > >
> > > >  Powered by Jetty://
> > > >
> > > >
> > > >
> > > >  Tobias
> > > >
> > > >  -------- Original-Nachricht --------
> > > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> > > >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > > >
> > > > > An: users@...
> > > >  > Betreff: Re: [trails-users] Lazy Fetches
> > > >
> > > >
> > > >
> > > >  > Hi Tobias
> > > >  >
> > > >  > As long as I know Trails doesn't force you to use EAGER fetches.
> > > >  > Can you give me more details about what problems are you
> > > experiencing?
> > > >  > I did a little test setting Car's Make and Model properties to
> > LAZY,
> > > >  > and I didn't get any exceptions.
> > > >  > There is no problem in releasing a 1.1.2 version if we found what
> > the
> > > >  > problem is.
> > > >  >
> > > >  >
> > > >  > Alejandro.
> > > >  >
> > > >  >
> > > >  > --
> > > >  > Alejandro Scandroli - http://weblog.amneris.es/
> > > >  > Amneris: We build process-driven web applications.
> > > >  > http://www.amneris.es
> > > >  >
> > > >  >
> > > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx
> > <superoverdrive@...>
> > > >  > wrote:
> > > >  > > Would it be possible to support Lazy Fetches in trails 1.1? (an
> > > update?)
> > > >  > >  Or would those changes take too long so the time is better
> > > invested in
> > > >  > working on trails 1.2 ?
> > > >  > >
> > > >  > >
> > > >  > >
> > > ---------------------------------------------------------------------
> > > >  > >  To unsubscribe from this list, please visit:
> > > >  > >
> > > >  > >     http://xircles.codehaus.org/manage_email
> > > >  > >
> > > >  > >
> > > >  > >
> > > >  >
> > > >  >
> > ---------------------------------------------------------------------
> > > >  > To unsubscribe from this list, please visit:
> > > >  >
> > > >  >     http://xircles.codehaus.org/manage_email
> > > >  >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > >  To unsubscribe from this list, please visit:
> > > >
> > > >     http://xircles.codehaus.org/manage_email
> > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe from this list, please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Alejandro Scandroli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That's good, that's good, that means that the first "resource" your
browser is asking for is protected by acegi and that's why after the
successful login it redirects you to it.
Add this rule to your "filterInvocationInterceptor" bean in acegi-security.xml

/assets/static/**/*.js=ROLE_ANONYMOUS,ROLE_USER

Alejandro.





On Mon, May 5, 2008 at 10:57 AM, Tobias Marx <superoverdrive@...> wrote:

> If I change the hibernate filter to /* instead of /app/* like in your example, I am forwarded to:
>
>  http://localhost:8080/assets/static/tapestry/core.js
>
>  when I try to login.....
>
>
>  -------- Original-Nachricht --------
>  > Datum: Mon, 05 May 2008 10:37:06 +0200
>  > Von: "Tobias Marx" <superoverdrive@...>
>
>
> > An: users@...
>  > Betreff: Re: [trails-users] Lazy Fetches
>
>  > My web.xml looks like that:
>  >
>  >       <context-param>
>  >               <param-name>contextConfigLocation</param-name>
>  >               <param-value>
>  >                       classpath:applicationContext.xml
>  >                       classpath:acegi-security.xml
>  >                       classpath:applicationContext-seedData.xml
>  >               </param-value>
>  >       </context-param>
>  >
>  >       <!-- Spring Open Session In View Pattern filter -->
>  >       <filter>
>  >               <filter-name>hibernateFilter</filter-name>
>  >               <filter-class>
>  >                       org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
>  >               </filter-class>
>  >       </filter>
>  >
>  >
>  >       <!-- Added for Acegi support. -->
>  >       <filter>
>  >               <filter-name>Acegi Filter Chain Proxy</filter-name>
>  >               <filter-class>
>  >                       org.acegisecurity.util.FilterToBeanProxy
>  >               </filter-class>
>  >               <init-param>
>  >                       <param-name>targetClass</param-name>
>  >                       <param-value>
>  >                               org.acegisecurity.util.FilterChainProxy
>  >                       </param-value>
>  >               </init-param>
>  >       </filter>
>  >       <!-- Ended added for Acegi support. -->
>  >
>  >       <filter>
>  >               <filter-name>redirect</filter-name>
>  >               <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
>  >       </filter>
>  >
>  >
>  >       <!-- Added for Acegi support. -->
>  >       <filter-mapping>
>  >               <filter-name>Acegi Filter Chain Proxy</filter-name>
>  >               <url-pattern>/*</url-pattern>
>  >       </filter-mapping>
>  >       <!--  Ended added for Acegi support. -->
>  >
>  >       <filter-mapping>
>  >               <filter-name>redirect</filter-name>
>  >               <url-pattern>/</url-pattern>
>  >       </filter-mapping>
>  >
>  >       <!-- Spring/Hibernate filter mappings -->
>  >       <filter-mapping>
>  >               <filter-name>hibernateFilter</filter-name>
>  >               <url-pattern>/app/*</url-pattern>
>  >       </filter-mapping>
>  >
>  >       <filter-mapping>
>  >               <filter-name>hibernateFilter</filter-name>
>  >               <url-pattern>/app</url-pattern>
>  >       </filter-mapping>
>  >
>  >       <filter-mapping>
>  >               <filter-name>hibernateFilter</filter-name>
>  >               <url-pattern>*.page</url-pattern>
>  >       </filter-mapping>
>  >
>  >       <filter-mapping>
>  >               <filter-name>hibernateFilter</filter-name>
>  >               <url-pattern>*.direct</url-pattern>
>  >       </filter-mapping>
>  >
>  >       <filter-mapping>
>  >               <filter-name>hibernateFilter</filter-name>
>  >               <url-pattern>*.sdirect</url-pattern>
>  >       </filter-mapping>
>  >
>  >       <filter-mapping>
>  >               <filter-name>hibernateFilter</filter-name>
>  >               <url-pattern>/assets/*</url-pattern>
>  >       </filter-mapping>
>  >
>  >       <filter-mapping>
>  >               <filter-name>hibernateFilter</filter-name>
>  >               <url-pattern>*.svc</url-pattern>
>  >       </filter-mapping>
>  >
>  >       <listener>
>  >               <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>  >       </listener>
>  >       <servlet>
>  >               <servlet-name>trails</servlet-name>
>  >               <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
>  >               <load-on-startup>1</load-on-startup>
>  >       </servlet>
>  >
>  >       <servlet-mapping>
>  >               <servlet-name>trails</servlet-name>
>  >               <url-pattern>/app</url-pattern>
>  >       </servlet-mapping>
>  >
>  >       <servlet-mapping>
>  >               <servlet-name>trails</servlet-name>
>  >               <url-pattern>*.page</url-pattern>
>  >       </servlet-mapping>
>  >
>  >       <servlet-mapping>
>  >               <servlet-name>trails</servlet-name>
>  >               <url-pattern>*.direct</url-pattern>
>  >       </servlet-mapping>
>  >
>  >       <servlet-mapping>
>  >               <servlet-name>trails</servlet-name>
>  >               <url-pattern>*.sdirect</url-pattern>
>  >       </servlet-mapping>
>  >
>  >       <servlet-mapping>
>  >               <servlet-name>trails</servlet-name>
>  >               <url-pattern>/assets/*</url-pattern>
>  >       </servlet-mapping>
>  >
>  >       <servlet-mapping>
>  >               <servlet-name>trails</servlet-name>
>  >               <url-pattern>*.svc</url-pattern>
>  >       </servlet-mapping>
>  >
>  >
>  > The stack trace:
>  >
>  > 10:33:24.875 WARN!! [SocketListener0-0]
>  > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590) >11>
>  > /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
>  > org.hibernate.LazyInitializationException: failed to lazily initialize a
>  > collection of role: com.company.User.roles, no session or session was closed
>  >       at
>  > org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
>  >       at
>  > org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
>  >       at
>  > org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
>  >       at
>  > org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
>  >       at
>  > org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
>  >       at java.lang.String.valueOf(String.java:2615)
>  >       at java.lang.StringBuilder.append(StringBuilder.java:116)
>  >       at com.company.User.getAuthorities(User.java:209)
>  >       at
>  > org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
>  >       at
>  > org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
>  >       at
>  > org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
>  >       at
>  > org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
>  >       at
>  > org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
>  >       at
>  > org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
>  >       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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
>  >       at
>  > org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
>  >       at
>  > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
>  >       at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>  >       at
>  > org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
>  >       at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
>  >       at org.mortbay.http.HttpServer.service(HttpServer.java:896)
>  >       at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
>  >       at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
>  >       at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
>  >       at
>  > org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
>  >       at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
>  >       at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>  >
>  > This happens on the default applications (quick start + security) when
>  > using LAZY fetches on the role and trying to login as admin/admin.
>  >
>  >
>  > -------- Original-Nachricht --------
>  > > Datum: Wed, 30 Apr 2008 10:41:11 +0200
>  > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
>  > > An: users@...
>  > > Betreff: Re: [trails-users] Lazy Fetches
>  >
>  > > I wasn't talking about 1.2, I was talking about doing a minor update
>  > > over 1.1.1, releasing 1.1.2 with a patch for your issues.
>  > >
>  > > Ahhhh yes, I saw that with security, the problem is in the order of
>  > > the filters in the web.xml file.
>  > >
>  > > Try adding an "hibernateFilter" filter-mapping before the "Acegi
>  > > Filter Chain Proxy" filter-mapping
>  > >
>  > >     <!-- Added for Acegi support. -->
>  > >     <filter-mapping>
>  > >         <filter-name>hibernateFilter</filter-name>
>  > >         <url-pattern>/*</url-pattern>
>  > >     </filter-mapping>
>  > >
>  > >     <filter-mapping>
>  > >         <filter-name>Acegi Filter Chain Proxy</filter-name>
>  > >         <url-pattern>/*</url-pattern>
>  > >     </filter-mapping>
>  > >     <!--  Ended added for Acegi support. -->
>  > >
>  > >
>  > > Anyway, this could create another issue, it depends on how do you
>  > > manage the load/unload of your current user.
>  > > But let's deal with one problem at a time.
>  > > Try the above and let me know how it goes.
>  > >
>  > > Alejandro.
>  > >
>  > > --
>  > > Alejandro Scandroli - http://weblog.amneris.es/
>  > > Amneris: We build process-driven web applications.
>  > > http://www.amneris.es
>  > >
>  > >
>  > > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx <superoverdrive@...>
>  > > wrote:
>  > > > Hi Alejandro!
>  > > >
>  > > >  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1 was
>  > still
>  > > the latest stable release).
>  > > >
>  > > >  Just do the quick start application using security and replace EAGER
>  > by
>  > > LAZY and login as admin/admin.
>  > > >
>  > > >  HTTP ERROR: 500
>  > > >
>  > > >  failed to lazily initialize a collection of role: sample.User.roles,
>  > no
>  > > session or session was closed
>  > > >
>  > > >  RequestURI=/j_acegi_security_check
>  > > >
>  > > >  Powered by Jetty://
>  > > >
>  > > >
>  > > >
>  > > >  Tobias
>  > > >
>  > > >  -------- Original-Nachricht --------
>  > > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
>  > > >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
>  > > >
>  > > > > An: users@...
>  > > >  > Betreff: Re: [trails-users] Lazy Fetches
>  > > >
>  > > >
>  > > >
>  > > >  > Hi Tobias
>  > > >  >
>  > > >  > As long as I know Trails doesn't force you to use EAGER fetches.
>  > > >  > Can you give me more details about what problems are you
>  > > experiencing?
>  > > >  > I did a little test setting Car's Make and Model properties to
>  > LAZY,
>  > > >  > and I didn't get any exceptions.
>  > > >  > There is no problem in releasing a 1.1.2 version if we found what
>  > the
>  > > >  > problem is.
>  > > >  >
>  > > >  >
>  > > >  > Alejandro.
>  > > >  >
>  > > >  >
>  > > >  > --
>  > > >  > Alejandro Scandroli - http://weblog.amneris.es/
>  > > >  > Amneris: We build process-driven web applications.
>  > > >  > http://www.amneris.es
>  > > >  >
>  > > >  >
>  > > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx
>  > <superoverdrive@...>
>  > > >  > wrote:
>  > > >  > > Would it be possible to support Lazy Fetches in trails 1.1? (an
>  > > update?)
>  > > >  > >  Or would those changes take too long so the time is better
>  > > invested in
>  > > >  > working on trails 1.2 ?
>  > > >  > >
>  > > >  > >
>  > > >  > >
>  > > ---------------------------------------------------------------------
>  > > >  > >  To unsubscribe from this list, please visit:
>  > > >  > >
>  > > >  > >     http://xircles.codehaus.org/manage_email
>  > > >  > >
>  > > >  > >
>  > > >  > >
>  > > >  >
>  > > >  >
>  > ---------------------------------------------------------------------
>  > > >  > To unsubscribe from this list, please visit:
>  > > >  >
>  > > >  >     http://xircles.codehaus.org/manage_email
>  > > >  >
>  > > >
>  > > >  ---------------------------------------------------------------------
>  > > >  To unsubscribe from this list, please visit:
>  > > >
>  > > >     http://xircles.codehaus.org/manage_email
>  > > >
>  > > >
>  > > >
>  > >
>  > > ---------------------------------------------------------------------
>  > > To unsubscribe from this list, please visit:
>  > >
>  > >     http://xircles.codehaus.org/manage_email
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe from this list, please visit:
>  >
>  >     http://xircles.codehaus.org/manage_email
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Toby78 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok - with changing the filter order I could solve the Lazy initialization problem on the sample application.

When I copy this web.xml in a more complex web application, it does work with Lazy fetchs on most pages - but not all. I still get Lazy initialization exceptions on many pages.



12:23:50.281 ERROR! [SocketListener0-0] org.hibernate.LazyInitializationException.<init>(LazyInitializationException.java:19) >142> failed to lazily initialize a collection of role: com.company.dao.User.downloadedFeatures, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.company.dao.User.downloadedFeatures, no session or session was closed
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
        at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
        at org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
        at java.util.ArrayList.<init>(ArrayList.java:133)
        at org.apache.tapestry.coerce.CollectionToListConverter.convertValue(CollectionToListConverter.java:30)
        at org.apache.tapestry.coerce.TypeConverterWrapper.convertValue(TypeConverterWrapper.java:65)
        at $TypeConverter_119b89ac71b.convertValue($TypeConverter_119b89ac71b.java)
        at $TypeConverter_119b89ac71a.convertValue($TypeConverter_119b89ac71a.java)
        at org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(ValueConverterImpl.java:107)
        at $ValueConverter_119b89ac58e.coerceValue($ValueConverter_119b89ac58e.java)
        at org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:88)
        at $DownloadedFeaturesObjectTable_16.getInstances($DownloadedFeaturesObjectTable_16.java)
        at org.trails.component.ObjectTable.getSource(ObjectTable.java:248)
        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:585)
        at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:768)
        at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1213)
        at ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:60)
        at ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:144)
        at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1934)
        at ognl.ASTProperty.getValueBody(ASTProperty.java:109)
        at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:202)
        at ognl.SimpleNode.getValue(SimpleNode.java:246)
        at ognl.Ognl.getValue(Ognl.java:494)
        at ognl.Ognl.getValue(Ognl.java:458)
        at org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:153)
        at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
        at ognl.Ognl.compileExpression(Ognl.java:141)
        at org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheImpl.java:152)
        at org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression(ExpressionCacheImpl.java:115)
        at $ExpressionCache_119b89ac6e9.getCompiledExpression($ExpressionCache_119b89ac6e9.java)
        at org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBinding.java:134)
        at org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java:125)
        at org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:84)
        at $TableView_27.getSource($TableView_27.java)
        at org.apache.tapestry.contrib.table.components.TableView.generateTableModel(TableView.java:255)
        at org.apache.tapestry.contrib.table.components.TableViewSessionStateManager.recreateTableModel(TableViewSessionStateManager.java:65)
        at org.apache.tapestry.contrib.table.components.TableView.getTableModel(TableView.java:212)
        at org.apache.tapestry.contrib.table.components.TableView.validateValues(TableView.java:476)
        at org.apache.tapestry.contrib.table.components.TableView.renderComponent(TableView.java:509)
        at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
        at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
        at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
        at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
        at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
        at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
        at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
        at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
        at org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
        at org.apache.tapestry.form.FormSupportImpl.render(FormSupportImpl.java:504)
        at org.apache.tapestry.form.Form.renderComponent(Form.java:217)
        at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
        at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
        at org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
        at org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:39)
        at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
        at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
        at org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
        at org.apache.tapestry.html.Body.renderComponent(Body.java:38)
        at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
        at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
        at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
        at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
        at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
        at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
        at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
        at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:177)
        at org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:249)
        at org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:397)
        at org.apache.tapestry.services.impl.DefaultResponseBuilder.renderResponse(DefaultResponseBuilder.java:151)
        at org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(ResponseRendererImpl.java:33)
        at $ResponseRenderer_119b89ac5c0.renderResponse($ResponseRenderer_119b89ac5c0.java)
        at org.apache.tapestry.engine.PageService.service(PageService.java:68)
        at $IEngineService_119b89ac630.service($IEngineService_119b89ac630.java)
        at org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:72)
        at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:241)
        at org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:54)
        at $WebRequestServicer_119b89ac60c.service($WebRequestServicer_119b89ac60c.java)
        at org.trails.i18n.LocaleFilter.service(LocaleFilter.java:26)
        at $WebRequestServicerFilter_119b89ac60a.service($WebRequestServicerFilter_119b89ac60a.java)
        at $WebRequestServicer_119b89ac60e.service($WebRequestServicer_119b89ac60e.java)
        at $WebRequestServicer_119b89ac606.service($WebRequestServicer_119b89ac606.java)
        at org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:61)
        at $ServletRequestServicer_119b89ac5ec.service($ServletRequestServicer_119b89ac5ec.java)
        at org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
        at $ServletRequestServicerFilter_119b89ac5e8.service($ServletRequestServicerFilter_119b89ac5e8.java)
        at $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
        at org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
        at $ServletRequestServicerFilter_119b89ac5e6.service($ServletRequestServicerFilter_119b89ac5e6.java)
        at $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
        at org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
        at $ServletRequestServicerFilter_119b89ac5ea.service($ServletRequestServicerFilter_119b89ac5ea.java)
        at $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
        at $ServletRequestServicer_119b89ac5e0.service($ServletRequestServicer_119b89ac5e0.java)
        at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:126)
        at org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:103)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
        at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:822)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
        at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
        at org.apache.tapestry.RedirectFilter.doFilter(RedirectFilter.java:103)
        at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
        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.trails.security.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:152)
        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.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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
        at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
        at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
        at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
        at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
        at org.mortbay.http.HttpServer.service(HttpServer.java:896)
        at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
        at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
        at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
        at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)


-------- Original-Nachricht --------
> Datum: Mon, 5 May 2008 11:10:22 +0200
> Von: "Alejandro Scandroli" <alejandroscandroli@...>
> An: users@...
> Betreff: Re: [trails-users] Lazy Fetches

> That's good, that's good, that means that the first "resource" your
> browser is asking for is protected by acegi and that's why after the
> successful login it redirects you to it.
> Add this rule to your "filterInvocationInterceptor" bean in
> acegi-security.xml
>
> /assets/static/**/*.js=ROLE_ANONYMOUS,ROLE_USER
>
> Alejandro.
>
>
>
>
>
> On Mon, May 5, 2008 at 10:57 AM, Tobias Marx <superoverdrive@...>
> wrote:
> > If I change the hibernate filter to /* instead of /app/* like in your
> example, I am forwarded to:
> >
> >  http://localhost:8080/assets/static/tapestry/core.js
> >
> >  when I try to login.....
> >
> >
> >  -------- Original-Nachricht --------
> >  > Datum: Mon, 05 May 2008 10:37:06 +0200
> >  > Von: "Tobias Marx" <superoverdrive@...>
> >
> >
> > > An: users@...
> >  > Betreff: Re: [trails-users] Lazy Fetches
> >
> >  > My web.xml looks like that:
> >  >
> >  >       <context-param>
> >  >               <param-name>contextConfigLocation</param-name>
> >  >               <param-value>
> >  >                       classpath:applicationContext.xml
> >  >                       classpath:acegi-security.xml
> >  >                       classpath:applicationContext-seedData.xml
> >  >               </param-value>
> >  >       </context-param>
> >  >
> >  >       <!-- Spring Open Session In View Pattern filter -->
> >  >       <filter>
> >  >               <filter-name>hibernateFilter</filter-name>
> >  >               <filter-class>
> >  >                      
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> >  >               </filter-class>
> >  >       </filter>
> >  >
> >  >
> >  >       <!-- Added for Acegi support. -->
> >  >       <filter>
> >  >               <filter-name>Acegi Filter Chain Proxy</filter-name>
> >  >               <filter-class>
> >  >                       org.acegisecurity.util.FilterToBeanProxy
> >  >               </filter-class>
> >  >               <init-param>
> >  >                       <param-name>targetClass</param-name>
> >  >                       <param-value>
> >  >                               org.acegisecurity.util.FilterChainProxy
> >  >                       </param-value>
> >  >               </init-param>
> >  >       </filter>
> >  >       <!-- Ended added for Acegi support. -->
> >  >
> >  >       <filter>
> >  >               <filter-name>redirect</filter-name>
> >  >              
> <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
> >  >       </filter>
> >  >
> >  >
> >  >       <!-- Added for Acegi support. -->
> >  >       <filter-mapping>
> >  >               <filter-name>Acegi Filter Chain Proxy</filter-name>
> >  >               <url-pattern>/*</url-pattern>
> >  >       </filter-mapping>
> >  >       <!--  Ended added for Acegi support. -->
> >  >
> >  >       <filter-mapping>
> >  >               <filter-name>redirect</filter-name>
> >  >               <url-pattern>/</url-pattern>
> >  >       </filter-mapping>
> >  >
> >  >       <!-- Spring/Hibernate filter mappings -->
> >  >       <filter-mapping>
> >  >               <filter-name>hibernateFilter</filter-name>
> >  >               <url-pattern>/app/*</url-pattern>
> >  >       </filter-mapping>
> >  >
> >  >       <filter-mapping>
> >  >               <filter-name>hibernateFilter</filter-name>
> >  >               <url-pattern>/app</url-pattern>
> >  >       </filter-mapping>
> >  >
> >  >       <filter-mapping>
> >  >               <filter-name>hibernateFilter</filter-name>
> >  >               <url-pattern>*.page</url-pattern>
> >  >       </filter-mapping>
> >  >
> >  >       <filter-mapping>
> >  >               <filter-name>hibernateFilter</filter-name>
> >  >               <url-pattern>*.direct</url-pattern>
> >  >       </filter-mapping>
> >  >
> >  >       <filter-mapping>
> >  >               <filter-name>hibernateFilter</filter-name>
> >  >               <url-pattern>*.sdirect</url-pattern>
> >  >       </filter-mapping>
> >  >
> >  >       <filter-mapping>
> >  >               <filter-name>hibernateFilter</filter-name>
> >  >               <url-pattern>/assets/*</url-pattern>
> >  >       </filter-mapping>
> >  >
> >  >       <filter-mapping>
> >  >               <filter-name>hibernateFilter</filter-name>
> >  >               <url-pattern>*.svc</url-pattern>
> >  >       </filter-mapping>
> >  >
> >  >       <listener>
> >  >              
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> >  >       </listener>
> >  >       <servlet>
> >  >               <servlet-name>trails</servlet-name>
> >  >              
> <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
> >  >               <load-on-startup>1</load-on-startup>
> >  >       </servlet>
> >  >
> >  >       <servlet-mapping>
> >  >               <servlet-name>trails</servlet-name>
> >  >               <url-pattern>/app</url-pattern>
> >  >       </servlet-mapping>
> >  >
> >  >       <servlet-mapping>
> >  >               <servlet-name>trails</servlet-name>
> >  >               <url-pattern>*.page</url-pattern>
> >  >       </servlet-mapping>
> >  >
> >  >       <servlet-mapping>
> >  >               <servlet-name>trails</servlet-name>
> >  >               <url-pattern>*.direct</url-pattern>
> >  >       </servlet-mapping>
> >  >
> >  >       <servlet-mapping>
> >  >               <servlet-name>trails</servlet-name>
> >  >               <url-pattern>*.sdirect</url-pattern>
> >  >       </servlet-mapping>
> >  >
> >  >       <servlet-mapping>
> >  >               <servlet-name>trails</servlet-name>
> >  >               <url-pattern>/assets/*</url-pattern>
> >  >       </servlet-mapping>
> >  >
> >  >       <servlet-mapping>
> >  >               <servlet-name>trails</servlet-name>
> >  >               <url-pattern>*.svc</url-pattern>
> >  >       </servlet-mapping>
> >  >
> >  >
> >  > The stack trace:
> >  >
> >  > 10:33:24.875 WARN!! [SocketListener0-0]
> >  >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590) >11>
> >  >
> /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
> >  > org.hibernate.LazyInitializationException: failed to lazily
> initialize a
> >  > collection of role: com.company.User.roles, no session or session was
> closed
> >  >       at
> >  >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> >  >       at
> >  >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> >  >       at
> >  >
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> >  >       at
> >  >
> org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
> >  >       at
> >  >
> org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
> >  >       at java.lang.String.valueOf(String.java:2615)
> >  >       at java.lang.StringBuilder.append(StringBuilder.java:116)
> >  >       at com.company.User.getAuthorities(User.java:209)
> >  >       at
> >  >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
> >  >       at
> >  >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
> >  >       at
> >  >
> org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
> >  >       at
> >  >
> org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
> >  >       at
> >  >
> org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
> >  >       at
> >  >
> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
> >  >       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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >  >       at
> >  >
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> >  >       at
> >  >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> >  >       at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> >  >       at
> >  >
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> >  >       at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> >  >       at org.mortbay.http.HttpServer.service(HttpServer.java:896)
> >  >       at
> org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> >  >       at
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> >  >       at
> org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> >  >       at
> >  >
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> >  >       at
> org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> >  >       at
> org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> >  >
> >  > This happens on the default applications (quick start + security)
> when
> >  > using LAZY fetches on the role and trying to login as admin/admin.
> >  >
> >  >
> >  > -------- Original-Nachricht --------
> >  > > Datum: Wed, 30 Apr 2008 10:41:11 +0200
> >  > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> >  > > An: users@...
> >  > > Betreff: Re: [trails-users] Lazy Fetches
> >  >
> >  > > I wasn't talking about 1.2, I was talking about doing a minor
> update
> >  > > over 1.1.1, releasing 1.1.2 with a patch for your issues.
> >  > >
> >  > > Ahhhh yes, I saw that with security, the problem is in the order of
> >  > > the filters in the web.xml file.
> >  > >
> >  > > Try adding an "hibernateFilter" filter-mapping before the "Acegi
> >  > > Filter Chain Proxy" filter-mapping
> >  > >
> >  > >     <!-- Added for Acegi support. -->
> >  > >     <filter-mapping>
> >  > >         <filter-name>hibernateFilter</filter-name>
> >  > >         <url-pattern>/*</url-pattern>
> >  > >     </filter-mapping>
> >  > >
> >  > >     <filter-mapping>
> >  > >         <filter-name>Acegi Filter Chain Proxy</filter-name>
> >  > >         <url-pattern>/*</url-pattern>
> >  > >     </filter-mapping>
> >  > >     <!--  Ended added for Acegi support. -->
> >  > >
> >  > >
> >  > > Anyway, this could create another issue, it depends on how do you
> >  > > manage the load/unload of your current user.
> >  > > But let's deal with one problem at a time.
> >  > > Try the above and let me know how it goes.
> >  > >
> >  > > Alejandro.
> >  > >
> >  > > --
> >  > > Alejandro Scandroli - http://weblog.amneris.es/
> >  > > Amneris: We build process-driven web applications.
> >  > > http://www.amneris.es
> >  > >
> >  > >
> >  > > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx
> <superoverdrive@...>
> >  > > wrote:
> >  > > > Hi Alejandro!
> >  > > >
> >  > > >  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1
> was
> >  > still
> >  > > the latest stable release).
> >  > > >
> >  > > >  Just do the quick start application using security and replace
> EAGER
> >  > by
> >  > > LAZY and login as admin/admin.
> >  > > >
> >  > > >  HTTP ERROR: 500
> >  > > >
> >  > > >  failed to lazily initialize a collection of role:
> sample.User.roles,
> >  > no
> >  > > session or session was closed
> >  > > >
> >  > > >  RequestURI=/j_acegi_security_check
> >  > > >
> >  > > >  Powered by Jetty://
> >  > > >
> >  > > >
> >  > > >
> >  > > >  Tobias
> >  > > >
> >  > > >  -------- Original-Nachricht --------
> >  > > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> >  > > >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> >  > > >
> >  > > > > An: users@...
> >  > > >  > Betreff: Re: [trails-users] Lazy Fetches
> >  > > >
> >  > > >
> >  > > >
> >  > > >  > Hi Tobias
> >  > > >  >
> >  > > >  > As long as I know Trails doesn't force you to use EAGER
> fetches.
> >  > > >  > Can you give me more details about what problems are you
> >  > > experiencing?
> >  > > >  > I did a little test setting Car's Make and Model properties to
> >  > LAZY,
> >  > > >  > and I didn't get any exceptions.
> >  > > >  > There is no problem in releasing a 1.1.2 version if we found
> what
> >  > the
> >  > > >  > problem is.
> >  > > >  >
> >  > > >  >
> >  > > >  > Alejandro.
> >  > > >  >
> >  > > >  >
> >  > > >  > --
> >  > > >  > Alejandro Scandroli - http://weblog.amneris.es/
> >  > > >  > Amneris: We build process-driven web applications.
> >  > > >  > http://www.amneris.es
> >  > > >  >
> >  > > >  >
> >  > > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx
> >  > <superoverdrive@...>
> >  > > >  > wrote:
> >  > > >  > > Would it be possible to support Lazy Fetches in trails 1.1?
> (an
> >  > > update?)
> >  > > >  > >  Or would those changes take too long so the time is better
> >  > > invested in
> >  > > >  > working on trails 1.2 ?
> >  > > >  > >
> >  > > >  > >
> >  > > >  > >
> >  > >
> ---------------------------------------------------------------------
> >  > > >  > >  To unsubscribe from this list, please visit:
> >  > > >  > >
> >  > > >  > >     http://xircles.codehaus.org/manage_email
> >  > > >  > >
> >  > > >  > >
> >  > > >  > >
> >  > > >  >
> >  > > >  >
> >  > ---------------------------------------------------------------------
> >  > > >  > To unsubscribe from this list, please visit:
> >  > > >  >
> >  > > >  >     http://xircles.codehaus.org/manage_email
> >  > > >  >
> >  > > >
> >  > > >
> ---------------------------------------------------------------------
> >  > > >  To unsubscribe from this list, please visit:
> >  > > >
> >  > > >     http://xircles.codehaus.org/manage_email
> >  > > >
> >  > > >
> >  > > >
> >  > >
> >  > >
> ---------------------------------------------------------------------
> >  > > To unsubscribe from this list, please visit:
> >  > >
> >  > >     http://xircles.codehaus.org/manage_email
> >  > >
> >  >
> >  > ---------------------------------------------------------------------
> >  > To unsubscribe from this list, please visit:
> >  >
> >  >     http://xircles.codehaus.org/manage_email
> >  >
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Alejandro Scandroli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tobias

This is what I was expecting when I said: this could create another
issue, it depends on how do you
manage the load/unload of your current user. But let's deal with one
problem at a time.

Your CurrentUserFactory configuration must be storing the currentUser
in the session and that's why it's detached.
I think your only option in this case is to reattach the currentUser
to the current active hibernate session.

Alejandro.


On Mon, May 5, 2008 at 12:30 PM, Tobias Marx <superoverdrive@...> wrote:

> Ok - with changing the filter order I could solve the Lazy initialization problem on the sample application.
>
>  When I copy this web.xml in a more complex web application, it does work with Lazy fetchs on most pages - but not all. I still get Lazy initialization exceptions on many pages.
>
>
>
>  12:23:50.281 ERROR! [SocketListener0-0] org.hibernate.LazyInitializationException.<init>(LazyInitializationException.java:19) >142> failed to lazily initialize a collection of role: com.company.dao.User.downloadedFeatures, no session or session was closed
>  org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.company.dao.User.downloadedFeatures, no session or session was closed
>
>         at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
>         at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
>         at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
>         at org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
>         at java.util.ArrayList.<init>(ArrayList.java:133)
>         at org.apache.tapestry.coerce.CollectionToListConverter.convertValue(CollectionToListConverter.java:30)
>         at org.apache.tapestry.coerce.TypeConverterWrapper.convertValue(TypeConverterWrapper.java:65)
>         at $TypeConverter_119b89ac71b.convertValue($TypeConverter_119b89ac71b.java)
>         at $TypeConverter_119b89ac71a.convertValue($TypeConverter_119b89ac71a.java)
>         at org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(ValueConverterImpl.java:107)
>         at $ValueConverter_119b89ac58e.coerceValue($ValueConverter_119b89ac58e.java)
>         at org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:88)
>         at $DownloadedFeaturesObjectTable_16.getInstances($DownloadedFeaturesObjectTable_16.java)
>         at org.trails.component.ObjectTable.getSource(ObjectTable.java:248)
>         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:585)
>         at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:768)
>         at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1213)
>         at ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:60)
>         at ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:144)
>         at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1934)
>         at ognl.ASTProperty.getValueBody(ASTProperty.java:109)
>         at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:202)
>         at ognl.SimpleNode.getValue(SimpleNode.java:246)
>         at ognl.Ognl.getValue(Ognl.java:494)
>         at ognl.Ognl.getValue(Ognl.java:458)
>         at org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:153)
>         at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
>         at ognl.Ognl.compileExpression(Ognl.java:141)
>         at org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheImpl.java:152)
>         at org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression(ExpressionCacheImpl.java:115)
>         at $ExpressionCache_119b89ac6e9.getCompiledExpression($ExpressionCache_119b89ac6e9.java)
>         at org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBinding.java:134)
>         at org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java:125)
>         at org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:84)
>         at $TableView_27.getSource($TableView_27.java)
>         at org.apache.tapestry.contrib.table.components.TableView.generateTableModel(TableView.java:255)
>         at org.apache.tapestry.contrib.table.components.TableViewSessionStateManager.recreateTableModel(TableViewSessionStateManager.java:65)
>         at org.apache.tapestry.contrib.table.components.TableView.getTableModel(TableView.java:212)
>         at org.apache.tapestry.contrib.table.components.TableView.validateValues(TableView.java:476)
>         at org.apache.tapestry.contrib.table.components.TableView.renderComponent(TableView.java:509)
>         at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
>         at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
>         at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
>         at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
>         at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
>         at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
>         at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
>         at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
>         at org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
>         at org.apache.tapestry.form.FormSupportImpl.render(FormSupportImpl.java:504)
>         at org.apache.tapestry.form.Form.renderComponent(Form.java:217)
>         at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
>         at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
>         at org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
>         at org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:39)
>         at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
>         at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
>         at org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
>         at org.apache.tapestry.html.Body.renderComponent(Body.java:38)
>         at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
>         at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
>         at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
>         at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
>         at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
>         at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
>         at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
>         at org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:177)
>         at org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:249)
>         at org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:397)
>         at org.apache.tapestry.services.impl.DefaultResponseBuilder.renderResponse(DefaultResponseBuilder.java:151)
>         at org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(ResponseRendererImpl.java:33)
>         at $ResponseRenderer_119b89ac5c0.renderResponse($ResponseRenderer_119b89ac5c0.java)
>         at org.apache.tapestry.engine.PageService.service(PageService.java:68)
>         at $IEngineService_119b89ac630.service($IEngineService_119b89ac630.java)
>         at org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:72)
>         at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:241)
>         at org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:54)
>         at $WebRequestServicer_119b89ac60c.service($WebRequestServicer_119b89ac60c.java)
>         at org.trails.i18n.LocaleFilter.service(LocaleFilter.java:26)
>         at $WebRequestServicerFilter_119b89ac60a.service($WebRequestServicerFilter_119b89ac60a.java)
>         at $WebRequestServicer_119b89ac60e.service($WebRequestServicer_119b89ac60e.java)
>         at $WebRequestServicer_119b89ac606.service($WebRequestServicer_119b89ac606.java)
>         at org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:61)
>         at $ServletRequestServicer_119b89ac5ec.service($ServletRequestServicer_119b89ac5ec.java)
>         at org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
>         at $ServletRequestServicerFilter_119b89ac5e8.service($ServletRequestServicerFilter_119b89ac5e8.java)
>         at $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
>         at org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
>         at $ServletRequestServicerFilter_119b89ac5e6.service($ServletRequestServicerFilter_119b89ac5e6.java)
>         at $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
>         at org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
>         at $ServletRequestServicerFilter_119b89ac5ea.service($ServletRequestServicerFilter_119b89ac5ea.java)
>         at $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
>         at $ServletRequestServicer_119b89ac5e0.service($ServletRequestServicer_119b89ac5e0.java)
>         at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:126)
>         at org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:103)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
>         at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:822)
>         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
>
>         at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
>         at org.apache.tapestry.RedirectFilter.doFilter(RedirectFilter.java:103)
>
>         at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
>         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.trails.security.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:152)
>
>         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.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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
>         at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
>
>         at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
>         at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
>         at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
>         at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>         at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
>         at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
>         at org.mortbay.http.HttpServer.service(HttpServer.java:896)
>         at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
>         at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
>         at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
>         at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
>         at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
>         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>
>
>  -------- Original-Nachricht --------
>  > Datum: Mon, 5 May 2008 11:10:22 +0200
>
>
> > Von: "Alejandro Scandroli" <alejandroscandroli@...>
>  > An: users@...
>  > Betreff: Re: [trails-users] Lazy Fetches
>
>  > That's good, that's good, that means that the first "resource" your
>  > browser is asking for is protected by acegi and that's why after the
>  > successful login it redirects you to it.
>  > Add this rule to your "filterInvocationInterceptor" bean in
>  > acegi-security.xml
>  >
>  > /assets/static/**/*.js=ROLE_ANONYMOUS,ROLE_USER
>  >
>  > Alejandro.
>  >
>  >
>  >
>  >
>  >
>  > On Mon, May 5, 2008 at 10:57 AM, Tobias Marx <superoverdrive@...>
>  > wrote:
>  > > If I change the hibernate filter to /* instead of /app/* like in your
>  > example, I am forwarded to:
>  > >
>  > >  http://localhost:8080/assets/static/tapestry/core.js
>  > >
>  > >  when I try to login.....
>  > >
>  > >
>  > >  -------- Original-Nachricht --------
>  > >  > Datum: Mon, 05 May 2008 10:37:06 +0200
>  > >  > Von: "Tobias Marx" <superoverdrive@...>
>  > >
>  > >
>  > > > An: users@...
>  > >  > Betreff: Re: [trails-users] Lazy Fetches
>  > >
>  > >  > My web.xml looks like that:
>  > >  >
>  > >  >       <context-param>
>  > >  >               <param-name>contextConfigLocation</param-name>
>  > >  >               <param-value>
>  > >  >                       classpath:applicationContext.xml
>  > >  >                       classpath:acegi-security.xml
>  > >  >                       classpath:applicationContext-seedData.xml
>  > >  >               </param-value>
>  > >  >       </context-param>
>  > >  >
>  > >  >       <!-- Spring Open Session In View Pattern filter -->
>  > >  >       <filter>
>  > >  >               <filter-name>hibernateFilter</filter-name>
>  > >  >               <filter-class>
>  > >  >
>  > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
>  > >  >               </filter-class>
>  > >  >       </filter>
>  > >  >
>  > >  >
>  > >  >       <!-- Added for Acegi support. -->
>  > >  >       <filter>
>  > >  >               <filter-name>Acegi Filter Chain Proxy</filter-name>
>  > >  >               <filter-class>
>  > >  >                       org.acegisecurity.util.FilterToBeanProxy
>  > >  >               </filter-class>
>  > >  >               <init-param>
>  > >  >                       <param-name>targetClass</param-name>
>  > >  >                       <param-value>
>  > >  >                               org.acegisecurity.util.FilterChainProxy
>  > >  >                       </param-value>
>  > >  >               </init-param>
>  > >  >       </filter>
>  > >  >       <!-- Ended added for Acegi support. -->
>  > >  >
>  > >  >       <filter>
>  > >  >               <filter-name>redirect</filter-name>
>  > >  >
>  > <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
>  > >  >       </filter>
>  > >  >
>  > >  >
>  > >  >       <!-- Added for Acegi support. -->
>  > >  >       <filter-mapping>
>  > >  >               <filter-name>Acegi Filter Chain Proxy</filter-name>
>  > >  >               <url-pattern>/*</url-pattern>
>  > >  >       </filter-mapping>
>  > >  >       <!--  Ended added for Acegi support. -->
>  > >  >
>  > >  >       <filter-mapping>
>  > >  >               <filter-name>redirect</filter-name>
>  > >  >               <url-pattern>/</url-pattern>
>  > >  >       </filter-mapping>
>  > >  >
>  > >  >       <!-- Spring/Hibernate filter mappings -->
>  > >  >       <filter-mapping>
>  > >  >               <filter-name>hibernateFilter</filter-name>
>  > >  >               <url-pattern>/app/*</url-pattern>
>  > >  >       </filter-mapping>
>  > >  >
>  > >  >       <filter-mapping>
>  > >  >               <filter-name>hibernateFilter</filter-name>
>  > >  >               <url-pattern>/app</url-pattern>
>  > >  >       </filter-mapping>
>  > >  >
>  > >  >       <filter-mapping>
>  > >  >               <filter-name>hibernateFilter</filter-name>
>  > >  >               <url-pattern>*.page</url-pattern>
>  > >  >       </filter-mapping>
>  > >  >
>  > >  >       <filter-mapping>
>  > >  >               <filter-name>hibernateFilter</filter-name>
>  > >  >               <url-pattern>*.direct</url-pattern>
>  > >  >       </filter-mapping>
>  > >  >
>  > >  >       <filter-mapping>
>  > >  >               <filter-name>hibernateFilter</filter-name>
>  > >  >               <url-pattern>*.sdirect</url-pattern>
>  > >  >       </filter-mapping>
>  > >  >
>  > >  >       <filter-mapping>
>  > >  >               <filter-name>hibernateFilter</filter-name>
>  > >  >               <url-pattern>/assets/*</url-pattern>
>  > >  >       </filter-mapping>
>  > >  >
>  > >  >       <filter-mapping>
>  > >  >               <filter-name>hibernateFilter</filter-name>
>  > >  >               <url-pattern>*.svc</url-pattern>
>  > >  >       </filter-mapping>
>  > >  >
>  > >  >       <listener>
>  > >  >
>  > <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>  > >  >       </listener>
>  > >  >       <servlet>
>  > >  >               <servlet-name>trails</servlet-name>
>  > >  >
>  > <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
>  > >  >               <load-on-startup>1</load-on-startup>
>  > >  >       </servlet>
>  > >  >
>  > >  >       <servlet-mapping>
>  > >  >               <servlet-name>trails</servlet-name>
>  > >  >               <url-pattern>/app</url-pattern>
>  > >  >       </servlet-mapping>
>  > >  >
>  > >  >       <servlet-mapping>
>  > >  >               <servlet-name>trails</servlet-name>
>  > >  >               <url-pattern>*.page</url-pattern>
>  > >  >       </servlet-mapping>
>  > >  >
>  > >  >       <servlet-mapping>
>  > >  >               <servlet-name>trails</servlet-name>
>  > >  >               <url-pattern>*.direct</url-pattern>
>  > >  >       </servlet-mapping>
>  > >  >
>  > >  >       <servlet-mapping>
>  > >  >               <servlet-name>trails</servlet-name>
>  > >  >               <url-pattern>*.sdirect</url-pattern>
>  > >  >       </servlet-mapping>
>  > >  >
>  > >  >       <servlet-mapping>
>  > >  >               <servlet-name>trails</servlet-name>
>  > >  >               <url-pattern>/assets/*</url-pattern>
>  > >  >       </servlet-mapping>
>  > >  >
>  > >  >       <servlet-mapping>
>  > >  >               <servlet-name>trails</servlet-name>
>  > >  >               <url-pattern>*.svc</url-pattern>
>  > >  >       </servlet-mapping>
>  > >  >
>  > >  >
>  > >  > The stack trace:
>  > >  >
>  > >  > 10:33:24.875 WARN!! [SocketListener0-0]
>  > >  >
>  > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590) >11>
>  > >  >
>  > /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
>  > >  > org.hibernate.LazyInitializationException: failed to lazily
>  > initialize a
>  > >  > collection of role: com.company.User.roles, no session or session was
>  > closed
>  > >  >       at
>  > >  >
>  > org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
>  > >  >       at
>  > >  >
>  > org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
>  > >  >       at
>  > >  >
>  > org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
>  > >  >       at
>  > >  >
>  > org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
>  > >  >       at
>  > >  >
>  > org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
>  > >  >       at java.lang.String.valueOf(String.java:2615)
>  > >  >       at java.lang.StringBuilder.append(StringBuilder.java:116)
>  > >  >       at com.company.User.getAuthorities(User.java:209)
>  > >  >       at
>  > >  >
>  > org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
>  > >  >       at
>  > >  >
>  > org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
>  > >  >       at
>  > >  >
>  > org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
>  > >  >       at
>  > >  >
>  > org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
>  > >  >       at
>  > >  >
>  > org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
>  > >  >       at
>  > >  >
>  > org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
>  > >  >       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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
>  > >  >       at
>  > >  >
>  > org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
>  > >  >       at
>  > >  >
>  > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
>  > >  >       at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>  > >  >       at
>  > >  >
>  > org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
>  > >  >       at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
>  > >  >       at org.mortbay.http.HttpServer.service(HttpServer.java:896)
>  > >  >       at
>  > org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
>  > >  >       at
>  > org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
>  > >  >       at
>  > org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
>  > >  >       at
>  > >  >
>  > org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
>  > >  >       at
>  > org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
>  > >  >       at
>  > org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>  > >  >
>  > >  > This happens on the default applications (quick start + security)
>  > when
>  > >  > using LAZY fetches on the role and trying to login as admin/admin.
>  > >  >
>  > >  >
>  > >  > -------- Original-Nachricht --------
>  > >  > > Datum: Wed, 30 Apr 2008 10:41:11 +0200
>  > >  > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
>  > >  > > An: users@...
>  > >  > > Betreff: Re: [trails-users] Lazy Fetches
>  > >  >
>  > >  > > I wasn't talking about 1.2, I was talking about doing a minor
>  > update
>  > >  > > over 1.1.1, releasing 1.1.2 with a patch for your issues.
>  > >  > >
>  > >  > > Ahhhh yes, I saw that with security, the problem is in the order of
>  > >  > > the filters in the web.xml file.
>  > >  > >
>  > >  > > Try adding an "hibernateFilter" filter-mapping before the "Acegi
>  > >  > > Filter Chain Proxy" filter-mapping
>  > >  > >
>  > >  > >     <!-- Added for Acegi support. -->
>  > >  > >     <filter-mapping>
>  > >  > >         <filter-name>hibernateFilter</filter-name>
>  > >  > >         <url-pattern>/*</url-pattern>
>  > >  > >     </filter-mapping>
>  > >  > >
>  > >  > >     <filter-mapping>
>  > >  > >         <filter-name>Acegi Filter Chain Proxy</filter-name>
>  > >  > >         <url-pattern>/*</url-pattern>
>  > >  > >     </filter-mapping>
>  > >  > >     <!--  Ended added for Acegi support. -->
>  > >  > >
>  > >  > >
>  > >  > > Anyway, this could create another issue, it depends on how do you
>  > >  > > manage the load/unload of your current user.
>  > >  > > But let's deal with one problem at a time.
>  > >  > > Try the above and let me know how it goes.
>  > >  > >
>  > >  > > Alejandro.
>  > >  > >
>  > >  > > --
>  > >  > > Alejandro Scandroli - http://weblog.amneris.es/
>  > >  > > Amneris: We build process-driven web applications.
>  > >  > > http://www.amneris.es
>  > >  > >
>  > >  > >
>  > >  > > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx
>  > <superoverdrive@...>
>  > >  > > wrote:
>  > >  > > > Hi Alejandro!
>  > >  > > >
>  > >  > > >  I was using 1.1.1....I could also try out 1.1.2 (though 1.1.1
>  > was
>  > >  > still
>  > >  > > the latest stable release).
>  > >  > > >
>  > >  > > >  Just do the quick start application using security and replace
>  > EAGER
>  > >  > by
>  > >  > > LAZY and login as admin/admin.
>  > >  > > >
>  > >  > > >  HTTP ERROR: 500
>  > >  > > >
>  > >  > > >  failed to lazily initialize a collection of role:
>  > sample.User.roles,
>  > >  > no
>  > >  > > session or session was closed
>  > >  > > >
>  > >  > > >  RequestURI=/j_acegi_security_check
>  > >  > > >
>  > >  > > >  Powered by Jetty://
>  > >  > > >
>  > >  > > >
>  > >  > > >
>  > >  > > >  Tobias
>  > >  > > >
>  > >  > > >  -------- Original-Nachricht --------
>  > >  > > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
>  > >  > > >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
>  > >  > > >
>  > >  > > > > An: users@...
>  > >  > > >  > Betreff: Re: [trails-users] Lazy Fetches
>  > >  > > >
>  > >  > > >
>  > >  > > >
>  > >  > > >  > Hi Tobias
>  > >  > > >  >
>  > >  > > >  > As long as I know Trails doesn't force you to use EAGER
>  > fetches.
>  > >  > > >  > Can you give me more details about what problems are you
>  > >  > > experiencing?
>  > >  > > >  > I did a little test setting Car's Make and Model properties to
>  > >  > LAZY,
>  > >  > > >  > and I didn't get any exceptions.
>  > >  > > >  > There is no problem in releasing a 1.1.2 version if we found
>  > what
>  > >  > the
>  > >  > > >  > problem is.
>  > >  > > >  >
>  > >  > > >  >
>  > >  > > >  > Alejandro.
>  > >  > > >  >
>  > >  > > >  >
>  > >  > > >  > --
>  > >  > > >  > Alejandro Scandroli - http://weblog.amneris.es/
>  > >  > > >  > Amneris: We build process-driven web applications.
>  > >  > > >  > http://www.amneris.es
>  > >  > > >  >
>  > >  > > >  >
>  > >  > > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx
>  > >  > <superoverdrive@...>
>  > >  > > >  > wrote:
>  > >  > > >  > > Would it be possible to support Lazy Fetches in trails 1.1?
>  > (an
>  > >  > > update?)
>  > >  > > >  > >  Or would those changes take too long so the time is better
>  > >  > > invested in
>  > >  > > >  > working on trails 1.2 ?
>  > >  > > >  > >
>  > >  > > >  > >
>  > >  > > >  > >
>  > >  > >
>  > ---------------------------------------------------------------------
>  > >  > > >  > >  To unsubscribe from this list, please visit:
>  > >  > > >  > >
>  > >  > > >  > >     http://xircles.codehaus.org/manage_email
>  > >  > > >  > >
>  > >  > > >  > >
>  > >  > > >  > >
>  > >  > > >  >
>  > >  > > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  > > >  > To unsubscribe from this list, please visit:
>  > >  > > >  >
>  > >  > > >  >     http://xircles.codehaus.org/manage_email
>  > >  > > >  >
>  > >  > > >
>  > >  > > >
>  > ---------------------------------------------------------------------
>  > >  > > >  To unsubscribe from this list, please visit:
>  > >  > > >
>  > >  > > >     http://xircles.codehaus.org/manage_email
>  > >  > > >
>  > >  > > >
>  > >  > > >
>  > >  > >
>  > >  > >
>  > ---------------------------------------------------------------------
>  > >  > > To unsubscribe from this list, please visit:
>  > >  > >
>  > >  > >     http://xircles.codehaus.org/manage_email
>  > >  > >
>  > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  > To unsubscribe from this list, please visit:
>  > >  >
>  > >  >     http://xircles.codehaus.org/manage_email
>  > >  >
>  > >
>  > >  ---------------------------------------------------------------------
>  > >  To unsubscribe from this list, please visit:
>  > >
>  > >     http://xircles.codehaus.org/manage_email
>  > >
>  > >
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe from this list, please visit:
>  >
>  >     http://xircles.codehaus.org/manage_email
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Toby78 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks!

Does this mean, you should in general never just use the getUser() method on its own?

Seems like you can never be sure whether it is attched or detached?

So what is the "good-practice" way of retrieving a user in general?


-------- Original-Nachricht --------
> Datum: Tue, 6 May 2008 00:45:02 +0200
> Von: "Alejandro Scandroli" <alejandroscandroli@...>
> An: users@...
> Betreff: Re: [trails-users] Lazy Fetches

> Hi Tobias
>
> This is what I was expecting when I said: this could create another
> issue, it depends on how do you
> manage the load/unload of your current user. But let's deal with one
> problem at a time.
>
> Your CurrentUserFactory configuration must be storing the currentUser
> in the session and that's why it's detached.
> I think your only option in this case is to reattach the currentUser
> to the current active hibernate session.
>
> Alejandro.
>
>
> On Mon, May 5, 2008 at 12:30 PM, Tobias Marx <superoverdrive@...>
> wrote:
> > Ok - with changing the filter order I could solve the Lazy
> initialization problem on the sample application.
> >
> >  When I copy this web.xml in a more complex web application, it does
> work with Lazy fetchs on most pages - but not all. I still get Lazy
> initialization exceptions on many pages.
> >
> >
> >
> >  12:23:50.281 ERROR! [SocketListener0-0]
> org.hibernate.LazyInitializationException.<init>(LazyInitializationException.java:19) >142> failed to
> lazily initialize a collection of role:
> com.company.dao.User.downloadedFeatures, no session or session was closed
> >  org.hibernate.LazyInitializationException: failed to lazily initialize
> a collection of role: com.company.dao.User.downloadedFeatures, no session
> or session was closed
> >
> >         at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> >         at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> >         at
> org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
> >         at
> org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
> >         at java.util.ArrayList.<init>(ArrayList.java:133)
> >         at
> org.apache.tapestry.coerce.CollectionToListConverter.convertValue(CollectionToListConverter.java:30)
> >         at
> org.apache.tapestry.coerce.TypeConverterWrapper.convertValue(TypeConverterWrapper.java:65)
> >         at
> $TypeConverter_119b89ac71b.convertValue($TypeConverter_119b89ac71b.java)
> >         at
> $TypeConverter_119b89ac71a.convertValue($TypeConverter_119b89ac71a.java)
> >         at
> org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(ValueConverterImpl.java:107)
> >         at
> $ValueConverter_119b89ac58e.coerceValue($ValueConverter_119b89ac58e.java)
> >         at
> org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:88)
> >         at
> $DownloadedFeaturesObjectTable_16.getInstances($DownloadedFeaturesObjectTable_16.java)
> >         at
> org.trails.component.ObjectTable.getSource(ObjectTable.java:248)
> >         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:585)
> >         at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:768)
> >         at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1213)
> >         at
> ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:60)
> >         at
> ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:144)
> >         at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1934)
> >         at ognl.ASTProperty.getValueBody(ASTProperty.java:109)
> >         at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:202)
> >         at ognl.SimpleNode.getValue(SimpleNode.java:246)
> >         at ognl.Ognl.getValue(Ognl.java:494)
> >         at ognl.Ognl.getValue(Ognl.java:458)
> >         at
> org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:153)
> >         at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
> >         at ognl.Ognl.compileExpression(Ognl.java:141)
> >         at
> org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheImpl.java:152)
> >         at
> org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression(ExpressionCacheImpl.java:115)
> >         at
> $ExpressionCache_119b89ac6e9.getCompiledExpression($ExpressionCache_119b89ac6e9.java)
> >         at
> org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBinding.java:134)
> >         at
> org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java:125)
> >         at
> org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:84)
> >         at $TableView_27.getSource($TableView_27.java)
> >         at
> org.apache.tapestry.contrib.table.components.TableView.generateTableModel(TableView.java:255)
> >         at
> org.apache.tapestry.contrib.table.components.TableViewSessionStateManager.recreateTableModel(TableViewSessionStateManager.java:65)
> >         at
> org.apache.tapestry.contrib.table.components.TableView.getTableModel(TableView.java:212)
> >         at
> org.apache.tapestry.contrib.table.components.TableView.validateValues(TableView.java:476)
> >         at
> org.apache.tapestry.contrib.table.components.TableView.renderComponent(TableView.java:509)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> >         at
> org.apache.tapestry.form.FormSupportImpl.render(FormSupportImpl.java:504)
> >         at org.apache.tapestry.form.Form.renderComponent(Form.java:217)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> >         at
> org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:39)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> >         at org.apache.tapestry.html.Body.renderComponent(Body.java:38)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:177)
> >         at
> org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:249)
> >         at
> org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:397)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.renderResponse(DefaultResponseBuilder.java:151)
> >         at
> org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(ResponseRendererImpl.java:33)
> >         at
> $ResponseRenderer_119b89ac5c0.renderResponse($ResponseRenderer_119b89ac5c0.java)
> >         at
> org.apache.tapestry.engine.PageService.service(PageService.java:68)
> >         at
> $IEngineService_119b89ac630.service($IEngineService_119b89ac630.java)
> >         at
> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:72)
> >         at
> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:241)
> >         at
> org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:54)
> >         at
> $WebRequestServicer_119b89ac60c.service($WebRequestServicer_119b89ac60c.java)
> >         at org.trails.i18n.LocaleFilter.service(LocaleFilter.java:26)
> >         at
> $WebRequestServicerFilter_119b89ac60a.service($WebRequestServicerFilter_119b89ac60a.java)
> >         at
> $WebRequestServicer_119b89ac60e.service($WebRequestServicer_119b89ac60e.java)
> >         at
> $WebRequestServicer_119b89ac606.service($WebRequestServicer_119b89ac606.java)
> >         at
> org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:61)
> >         at
> $ServletRequestServicer_119b89ac5ec.service($ServletRequestServicer_119b89ac5ec.java)
> >         at
> org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
> >         at
> $ServletRequestServicerFilter_119b89ac5e8.service($ServletRequestServicerFilter_119b89ac5e8.java)
> >         at
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> >         at
> org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
> >         at
> $ServletRequestServicerFilter_119b89ac5e6.service($ServletRequestServicerFilter_119b89ac5e6.java)
> >         at
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> >         at
> org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
> >         at
> $ServletRequestServicerFilter_119b89ac5ea.service($ServletRequestServicerFilter_119b89ac5ea.java)
> >         at
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> >         at
> $ServletRequestServicer_119b89ac5e0.service($ServletRequestServicer_119b89ac5e0.java)
> >         at
> org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:126)
> >         at
> org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:103)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> >         at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
> >         at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:822)
> >         at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
> >
> >         at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >         at
> org.apache.tapestry.RedirectFilter.doFilter(RedirectFilter.java:103)
> >
> >         at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >         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.trails.security.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:152)
> >
> >         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.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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >         at
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
> >         at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
> >
> >         at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >         at
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> >         at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> >         at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> >         at
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> >         at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> >         at org.mortbay.http.HttpServer.service(HttpServer.java:896)
> >         at
> org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> >         at
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> >         at
> org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> >         at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> >         at
> org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> >         at
> org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> >
> >
> >  -------- Original-Nachricht --------
> >  > Datum: Mon, 5 May 2008 11:10:22 +0200
> >
> >
> > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> >  > An: users@...
> >  > Betreff: Re: [trails-users] Lazy Fetches
> >
> >  > That's good, that's good, that means that the first "resource" your
> >  > browser is asking for is protected by acegi and that's why after the
> >  > successful login it redirects you to it.
> >  > Add this rule to your "filterInvocationInterceptor" bean in
> >  > acegi-security.xml
> >  >
> >  > /assets/static/**/*.js=ROLE_ANONYMOUS,ROLE_USER
> >  >
> >  > Alejandro.
> >  >
> >  >
> >  >
> >  >
> >  >
> >  > On Mon, May 5, 2008 at 10:57 AM, Tobias Marx <superoverdrive@...>
> >  > wrote:
> >  > > If I change the hibernate filter to /* instead of /app/* like in
> your
> >  > example, I am forwarded to:
> >  > >
> >  > >  http://localhost:8080/assets/static/tapestry/core.js
> >  > >
> >  > >  when I try to login.....
> >  > >
> >  > >
> >  > >  -------- Original-Nachricht --------
> >  > >  > Datum: Mon, 05 May 2008 10:37:06 +0200
> >  > >  > Von: "Tobias Marx" <superoverdrive@...>
> >  > >
> >  > >
> >  > > > An: users@...
> >  > >  > Betreff: Re: [trails-users] Lazy Fetches
> >  > >
> >  > >  > My web.xml looks like that:
> >  > >  >
> >  > >  >       <context-param>
> >  > >  >               <param-name>contextConfigLocation</param-name>
> >  > >  >               <param-value>
> >  > >  >                       classpath:applicationContext.xml
> >  > >  >                       classpath:acegi-security.xml
> >  > >  >                       classpath:applicationContext-seedData.xml
> >  > >  >               </param-value>
> >  > >  >       </context-param>
> >  > >  >
> >  > >  >       <!-- Spring Open Session In View Pattern filter -->
> >  > >  >       <filter>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <filter-class>
> >  > >  >
> >  > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> >  > >  >               </filter-class>
> >  > >  >       </filter>
> >  > >  >
> >  > >  >
> >  > >  >       <!-- Added for Acegi support. -->
> >  > >  >       <filter>
> >  > >  >               <filter-name>Acegi Filter Chain
> Proxy</filter-name>
> >  > >  >               <filter-class>
> >  > >  >                       org.acegisecurity.util.FilterToBeanProxy
> >  > >  >               </filter-class>
> >  > >  >               <init-param>
> >  > >  >                       <param-name>targetClass</param-name>
> >  > >  >                       <param-value>
> >  > >  >                              
> org.acegisecurity.util.FilterChainProxy
> >  > >  >                       </param-value>
> >  > >  >               </init-param>
> >  > >  >       </filter>
> >  > >  >       <!-- Ended added for Acegi support. -->
> >  > >  >
> >  > >  >       <filter>
> >  > >  >               <filter-name>redirect</filter-name>
> >  > >  >
> >  > <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
> >  > >  >       </filter>
> >  > >  >
> >  > >  >
> >  > >  >       <!-- Added for Acegi support. -->
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>Acegi Filter Chain
> Proxy</filter-name>
> >  > >  >               <url-pattern>/*</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >       <!--  Ended added for Acegi support. -->
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>redirect</filter-name>
> >  > >  >               <url-pattern>/</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <!-- Spring/Hibernate filter mappings -->
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>/app/*</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>/app</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>*.page</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>*.direct</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>*.sdirect</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>/assets/*</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>*.svc</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <listener>
> >  > >  >
> >  >
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> >  > >  >       </listener>
> >  > >  >       <servlet>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >
> >  >
> <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
> >  > >  >               <load-on-startup>1</load-on-startup>
> >  > >  >       </servlet>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>/app</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>*.page</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>*.direct</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>*.sdirect</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>/assets/*</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>*.svc</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >
> >  > >  > The stack trace:
> >  > >  >
> >  > >  > 10:33:24.875 WARN!! [SocketListener0-0]
> >  > >  >
> >  >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590) >11>
> >  > >  >
> >  >
> /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
> >  > >  > org.hibernate.LazyInitializationException: failed to lazily
> >  > initialize a
> >  > >  > collection of role: com.company.User.roles, no session or
> session was
> >  > closed
> >  > >  >       at
> >  > >  >
> >  >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> >  > >  >       at
> >  > >  >
> >  >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> >  > >  >       at
> >  > >  >
> >  >
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> >  > >  >       at
> >  > >  >
> >  >
> org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
> >  > >  >       at
> >  > >  >
> >  >
> org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
> >  > >  >       at java.lang.String.valueOf(String.java:2615)
> >  > >  >       at java.lang.StringBuilder.append(StringBuilder.java:116)
> >  > >  >       at com.company.User.getAuthorities(User.java:209)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
> >  > >  >       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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >  > >  >       at
> >  > >  >
> >  >
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> >  > >  >       at
> >  > >  >
> >  >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> >  > >  >       at
> org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> >  > >  >       at
> >  > >  >
> >  >
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> >  > >  >       at
> org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> >  > >  >       at
> org.mortbay.http.HttpServer.service(HttpServer.java:896)
> >  > >  >       at
> >  > org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> >  > >  >       at
> >  > org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> >  > >  >       at
> >  > org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> >  > >  >       at
> >  > >  >
> >  >
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> >  > >  >       at
> >  > org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> >  > >  >       at
> >  > org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> >  > >  >
> >  > >  > This happens on the default applications (quick start +
> security)
> >  > when
> >  > >  > using LAZY fetches on the role and trying to login as
> admin/admin.
> >  > >  >
> >  > >  >
> >  > >  > -------- Original-Nachricht --------
> >  > >  > > Datum: Wed, 30 Apr 2008 10:41:11 +0200
> >  > >  > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> >  > >  > > An: users@...
> >  > >  > > Betreff: Re: [trails-users] Lazy Fetches
> >  > >  >
> >  > >  > > I wasn't talking about 1.2, I was talking about doing a minor
> >  > update
> >  > >  > > over 1.1.1, releasing 1.1.2 with a patch for your issues.
> >  > >  > >
> >  > >  > > Ahhhh yes, I saw that with security, the problem is in the
> order of
> >  > >  > > the filters in the web.xml file.
> >  > >  > >
> >  > >  > > Try adding an "hibernateFilter" filter-mapping before the
> "Acegi
> >  > >  > > Filter Chain Proxy" filter-mapping
> >  > >  > >
> >  > >  > >     <!-- Added for Acegi support. -->
> >  > >  > >     <filter-mapping>
> >  > >  > >         <filter-name>hibernateFilter</filter-name>
> >  > >  > >         <url-pattern>/*</url-pattern>
> >  > >  > >     </filter-mapping>
> >  > >  > >
> >  > >  > >     <filter-mapping>
> >  > >  > >         <filter-name>Acegi Filter Chain Proxy</filter-name>
> >  > >  > >         <url-pattern>/*</url-pattern>
> >  > >  > >     </filter-mapping>
> >  > >  > >     <!--  Ended added for Acegi support. -->
> >  > >  > >
> >  > >  > >
> >  > >  > > Anyway, this could create another issue, it depends on how do
> you
> >  > >  > > manage the load/unload of your current user.
> >  > >  > > But let's deal with one problem at a time.
> >  > >  > > Try the above and let me know how it goes.
> >  > >  > >
> >  > >  > > Alejandro.
> >  > >  > >
> >  > >  > > --
> >  > >  > > Alejandro Scandroli - http://weblog.amneris.es/
> >  > >  > > Amneris: We build process-driven web applications.
> >  > >  > > http://www.amneris.es
> >  > >  > >
> >  > >  > >
> >  > >  > > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx
> >  > <superoverdrive@...>
> >  > >  > > wrote:
> >  > >  > > > Hi Alejandro!
> >  > >  > > >
> >  > >  > > >  I was using 1.1.1....I could also try out 1.1.2 (though
> 1.1.1
> >  > was
> >  > >  > still
> >  > >  > > the latest stable release).
> >  > >  > > >
> >  > >  > > >  Just do the quick start application using security and
> replace
> >  > EAGER
> >  > >  > by
> >  > >  > > LAZY and login as admin/admin.
> >  > >  > > >
> >  > >  > > >  HTTP ERROR: 500
> >  > >  > > >
> >  > >  > > >  failed to lazily initialize a collection of role:
> >  > sample.User.roles,
> >  > >  > no
> >  > >  > > session or session was closed
> >  > >  > > >
> >  > >  > > >  RequestURI=/j_acegi_security_check
> >  > >  > > >
> >  > >  > > >  Powered by Jetty://
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >  Tobias
> >  > >  > > >
> >  > >  > > >  -------- Original-Nachricht --------
> >  > >  > > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> >  > >  > > >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> >  > >  > > >
> >  > >  > > > > An: users@...
> >  > >  > > >  > Betreff: Re: [trails-users] Lazy Fetches
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >  > Hi Tobias
> >  > >  > > >  >
> >  > >  > > >  > As long as I know Trails doesn't force you to use EAGER
> >  > fetches.
> >  > >  > > >  > Can you give me more details about what problems are you
> >  > >  > > experiencing?
> >  > >  > > >  > I did a little test setting Car's Make and Model
> properties to
> >  > >  > LAZY,
> >  > >  > > >  > and I didn't get any exceptions.
> >  > >  > > >  > There is no problem in releasing a 1.1.2 version if we
> found
> >  > what
> >  > >  > the
> >  > >  > > >  > problem is.
> >  > >  > > >  >
> >  > >  > > >  >
> >  > >  > > >  > Alejandro.
> >  > >  > > >  >
> >  > >  > > >  >
> >  > >  > > >  > --
> >  > >  > > >  > Alejandro Scandroli - http://weblog.amneris.es/
> >  > >  > > >  > Amneris: We build process-driven web applications.
> >  > >  > > >  > http://www.amneris.es
> >  > >  > > >  >
> >  > >  > > >  >
> >  > >  > > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx
> >  > >  > <superoverdrive@...>
> >  > >  > > >  > wrote:
> >  > >  > > >  > > Would it be possible to support Lazy Fetches in trails
> 1.1?
> >  > (an
> >  > >  > > update?)
> >  > >  > > >  > >  Or would those changes take too long so the time is
> better
> >  > >  > > invested in
> >  > >  > > >  > working on trails 1.2 ?
> >  > >  > > >  > >
> >  > >  > > >  > >
> >  > >  > > >  > >
> >  > >  > >
> >  > ---------------------------------------------------------------------
> >  > >  > > >  > >  To unsubscribe from this list, please visit:
> >  > >  > > >  > >
> >  > >  > > >  > >     http://xircles.codehaus.org/manage_email
> >  > >  > > >  > >
> >  > >  > > >  > >
> >  > >  > > >  > >
> >  > >  > > >  >
> >  > >  > > >  >
> >  > >  >
> ---------------------------------------------------------------------
> >  > >  > > >  > To unsubscribe from this list, please visit:
> >  > >  > > >  >
> >  > >  > > >  >     http://xircles.codehaus.org/manage_email
> >  > >  > > >  >
> >  > >  > > >
> >  > >  > > >
> >  > ---------------------------------------------------------------------
> >  > >  > > >  To unsubscribe from this list, please visit:
> >  > >  > > >
> >  > >  > > >     http://xircles.codehaus.org/manage_email
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > >
> >  > >  > >
> >  > ---------------------------------------------------------------------
> >  > >  > > To unsubscribe from this list, please visit:
> >  > >  > >
> >  > >  > >     http://xircles.codehaus.org/manage_email
> >  > >  > >
> >  > >  >
> >  > >  >
> ---------------------------------------------------------------------
> >  > >  > To unsubscribe from this list, please visit:
> >  > >  >
> >  > >  >     http://xircles.codehaus.org/manage_email
> >  > >  >
> >  > >
> >  > >
> ---------------------------------------------------------------------
> >  > >  To unsubscribe from this list, please visit:
> >  > >
> >  > >     http://xircles.codehaus.org/manage_email
> >  > >
> >  > >
> >  > >
> >  >
> >  > ---------------------------------------------------------------------
> >  > To unsubscribe from this list, please visit:
> >  >
> >  >     http://xircles.codehaus.org/manage_email
> >  >
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Kalle Korhonen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, May 6, 2008 at 12:21 AM, Tobias Marx <superoverdrive@...> wrote:
Thanks!
Does this mean, you should in general never just use the getUser() method on its own?
Seems like you can never be sure whether it is attched or detached?

I think you can always call reattach to make sure.
 
So what is the "good-practice" way of retrieving a user in general?

Keep login and user edit/more complex use cases separate. If you need user data for acegi and/or displaying welcome text or some such, implement UserSummary object that doesn't have association to other objects. Implement a a full User object with associations as a composite object or inherited, and retrieve it in the request only when you need it.

Kalle

 
-------- Original-Nachricht --------
> Datum: Tue, 6 May 2008 00:45:02 +0200
> Von: "Alejandro Scandroli" <alejandroscandroli@...>
> An: users@...
> Betreff: Re: [trails-users] Lazy Fetches

> Hi Tobias
>
> This is what I was expecting when I said: this could create another
> issue, it depends on how do you
> manage the load/unload of your current user. But let's deal with one
> problem at a time.
>
> Your CurrentUserFactory configuration must be storing the currentUser
> in the session and that's why it's detached.
> I think your only option in this case is to reattach the currentUser
> to the current active hibernate session.
>
> Alejandro.
>
>
> On Mon, May 5, 2008 at 12:30 PM, Tobias Marx <superoverdrive@...>
> wrote:
> > Ok - with changing the filter order I could solve the Lazy
> initialization problem on the sample application.
> >
> >  When I copy this web.xml in a more complex web application, it does
> work with Lazy fetchs on most pages - but not all. I still get Lazy
> initialization exceptions on many pages.
> >
> >
> >
> >  12:23:50.281 ERROR! [SocketListener0-0]
> org.hibernate.LazyInitializationException.<init>(LazyInitializationException.java:19) >142> failed to
> lazily initialize a collection of role:
> com.company.dao.User.downloadedFeatures, no session or session was closed
> >  org.hibernate.LazyInitializationException: failed to lazily initialize
> a collection of role: com.company.dao.User.downloadedFeatures, no session
> or session was closed
> >
> >         at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> >         at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> >         at
> org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
> >         at
> org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
> >         at java.util.ArrayList.<init>(ArrayList.java:133)
> >         at
> org.apache.tapestry.coerce.CollectionToListConverter.convertValue(CollectionToListConverter.java:30)
> >         at
> org.apache.tapestry.coerce.TypeConverterWrapper.convertValue(TypeConverterWrapper.java:65)
> >         at
> $TypeConverter_119b89ac71b.convertValue($TypeConverter_119b89ac71b.java)
> >         at
> $TypeConverter_119b89ac71a.convertValue($TypeConverter_119b89ac71a.java)
> >         at
> org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(ValueConverterImpl.java:107)
> >         at
> $ValueConverter_119b89ac58e.coerceValue($ValueConverter_119b89ac58e.java)
> >         at
> org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:88)
> >         at
> $DownloadedFeaturesObjectTable_16.getInstances($DownloadedFeaturesObjectTable_16.java)
> >         at
> org.trails.component.ObjectTable.getSource(ObjectTable.java:248)
> >         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:585)
> >         at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:768)
> >         at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1213)
> >         at
> ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:60)
> >         at
> ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:144)
> >         at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1934)
> >         at ognl.ASTProperty.getValueBody(ASTProperty.java:109)
> >         at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:202)
> >         at ognl.SimpleNode.getValue(SimpleNode.java:246)
> >         at ognl.Ognl.getValue(Ognl.java:494)
> >         at ognl.Ognl.getValue(Ognl.java:458)
> >         at
> org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:153)
> >         at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
> >         at ognl.Ognl.compileExpression(Ognl.java:141)
> >         at
> org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheImpl.java:152)
> >         at
> org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression(ExpressionCacheImpl.java:115)
> >         at
> $ExpressionCache_119b89ac6e9.getCompiledExpression($ExpressionCache_119b89ac6e9.java)
> >         at
> org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBinding.java:134)
> >         at
> org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java:125)
> >         at
> org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:84)
> >         at $TableView_27.getSource($TableView_27.java)
> >         at
> org.apache.tapestry.contrib.table.components.TableView.generateTableModel(TableView.java:255)
> >         at
> org.apache.tapestry.contrib.table.components.TableViewSessionStateManager.recreateTableModel(TableViewSessionStateManager.java:65)
> >         at
> org.apache.tapestry.contrib.table.components.TableView.getTableModel(TableView.java:212)
> >         at
> org.apache.tapestry.contrib.table.components.TableView.validateValues(TableView.java:476)
> >         at
> org.apache.tapestry.contrib.table.components.TableView.renderComponent(TableView.java:509)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> >         at
> org.apache.tapestry.form.FormSupportImpl.render(FormSupportImpl.java:504)
> >         at org.apache.tapestry.form.Form.renderComponent(Form.java:217)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> >         at
> org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:39)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> >         at org.apache.tapestry.html.Body.renderComponent(Body.java:38)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> >         at
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> >         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:177)
> >         at
> org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:249)
> >         at
> org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:397)
> >         at
> org.apache.tapestry.services.impl.DefaultResponseBuilder.renderResponse(DefaultResponseBuilder.java:151)
> >         at
> org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(ResponseRendererImpl.java:33)
> >         at
> $ResponseRenderer_119b89ac5c0.renderResponse($ResponseRenderer_119b89ac5c0.java)
> >         at
> org.apache.tapestry.engine.PageService.service(PageService.java:68)
> >         at
> $IEngineService_119b89ac630.service($IEngineService_119b89ac630.java)
> >         at
> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:72)
> >         at
> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:241)
> >         at
> org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:54)
> >         at
> $WebRequestServicer_119b89ac60c.service($WebRequestServicer_119b89ac60c.java)
> >         at org.trails.i18n.LocaleFilter.service(LocaleFilter.java:26)
> >         at
> $WebRequestServicerFilter_119b89ac60a.service($WebRequestServicerFilter_119b89ac60a.java)
> >         at
> $WebRequestServicer_119b89ac60e.service($WebRequestServicer_119b89ac60e.java)
> >         at
> $WebRequestServicer_119b89ac606.service($WebRequestServicer_119b89ac606.java)
> >         at
> org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:61)
> >         at
> $ServletRequestServicer_119b89ac5ec.service($ServletRequestServicer_119b89ac5ec.java)
> >         at
> org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
> >         at
> $ServletRequestServicerFilter_119b89ac5e8.service($ServletRequestServicerFilter_119b89ac5e8.java)
> >         at
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> >         at
> org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
> >         at
> $ServletRequestServicerFilter_119b89ac5e6.service($ServletRequestServicerFilter_119b89ac5e6.java)
> >         at
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> >         at
> org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
> >         at
> $ServletRequestServicerFilter_119b89ac5ea.service($ServletRequestServicerFilter_119b89ac5ea.java)
> >         at
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> >         at
> $ServletRequestServicer_119b89ac5e0.service($ServletRequestServicer_119b89ac5e0.java)
> >         at
> org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:126)
> >         at
> org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:103)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> >         at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
> >         at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:822)
> >         at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
> >
> >         at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >         at
> org.apache.tapestry.RedirectFilter.doFilter(RedirectFilter.java:103)
> >
> >         at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >         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.trails.security.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:152)
> >
> >         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.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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >         at
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
> >         at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
> >
> >         at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >         at
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> >         at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> >         at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> >         at
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> >         at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> >         at org.mortbay.http.HttpServer.service(HttpServer.java:896)
> >         at
> org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> >         at
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> >         at
> org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> >         at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> >         at
> org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> >         at
> org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> >
> >
> >  -------- Original-Nachricht --------
> >  > Datum: Mon, 5 May 2008 11:10:22 +0200
> >
> >
> > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> >  > An: users@...
> >  > Betreff: Re: [trails-users] Lazy Fetches
> >
> >  > That's good, that's good, that means that the first "resource" your
> >  > browser is asking for is protected by acegi and that's why after the
> >  > successful login it redirects you to it.
> >  > Add this rule to your "filterInvocationInterceptor" bean in
> >  > acegi-security.xml
> >  >
> >  > /assets/static/**/*.js=ROLE_ANONYMOUS,ROLE_USER
> >  >
> >  > Alejandro.
> >  >
> >  >
> >  >
> >  >
> >  >
> >  > On Mon, May 5, 2008 at 10:57 AM, Tobias Marx <superoverdrive@...>
> >  > wrote:
> >  > > If I change the hibernate filter to /* instead of /app/* like in
> your
> >  > example, I am forwarded to:
> >  > >
> >  > >  http://localhost:8080/assets/static/tapestry/core.js
> >  > >
> >  > >  when I try to login.....
> >  > >
> >  > >
> >  > >  -------- Original-Nachricht --------
> >  > >  > Datum: Mon, 05 May 2008 10:37:06 +0200
> >  > >  > Von: "Tobias Marx" <superoverdrive@...>
> >  > >
> >  > >
> >  > > > An: users@...
> >  > >  > Betreff: Re: [trails-users] Lazy Fetches
> >  > >
> >  > >  > My web.xml looks like that:
> >  > >  >
> >  > >  >       <context-param>
> >  > >  >               <param-name>contextConfigLocation</param-name>
> >  > >  >               <param-value>
> >  > >  >                       classpath:applicationContext.xml
> >  > >  >                       classpath:acegi-security.xml
> >  > >  >                       classpath:applicationContext-seedData.xml
> >  > >  >               </param-value>
> >  > >  >       </context-param>
> >  > >  >
> >  > >  >       <!-- Spring Open Session In View Pattern filter -->
> >  > >  >       <filter>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <filter-class>
> >  > >  >
> >  > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> >  > >  >               </filter-class>
> >  > >  >       </filter>
> >  > >  >
> >  > >  >
> >  > >  >       <!-- Added for Acegi support. -->
> >  > >  >       <filter>
> >  > >  >               <filter-name>Acegi Filter Chain
> Proxy</filter-name>
> >  > >  >               <filter-class>
> >  > >  >                       org.acegisecurity.util.FilterToBeanProxy
> >  > >  >               </filter-class>
> >  > >  >               <init-param>
> >  > >  >                       <param-name>targetClass</param-name>
> >  > >  >                       <param-value>
> >  > >  >
> org.acegisecurity.util.FilterChainProxy
> >  > >  >                       </param-value>
> >  > >  >               </init-param>
> >  > >  >       </filter>
> >  > >  >       <!-- Ended added for Acegi support. -->
> >  > >  >
> >  > >  >       <filter>
> >  > >  >               <filter-name>redirect</filter-name>
> >  > >  >
> >  > <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
> >  > >  >       </filter>
> >  > >  >
> >  > >  >
> >  > >  >       <!-- Added for Acegi support. -->
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>Acegi Filter Chain
> Proxy</filter-name>
> >  > >  >               <url-pattern>/*</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >       <!--  Ended added for Acegi support. -->
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>redirect</filter-name>
> >  > >  >               <url-pattern>/</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <!-- Spring/Hibernate filter mappings -->
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>/app/*</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>/app</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>*.page</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>*.direct</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>*.sdirect</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>/assets/*</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <filter-mapping>
> >  > >  >               <filter-name>hibernateFilter</filter-name>
> >  > >  >               <url-pattern>*.svc</url-pattern>
> >  > >  >       </filter-mapping>
> >  > >  >
> >  > >  >       <listener>
> >  > >  >
> >  >
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> >  > >  >       </listener>
> >  > >  >       <servlet>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >
> >  >
> <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
> >  > >  >               <load-on-startup>1</load-on-startup>
> >  > >  >       </servlet>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>/app</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>*.page</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>*.direct</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>*.sdirect</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>/assets/*</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >       <servlet-mapping>
> >  > >  >               <servlet-name>trails</servlet-name>
> >  > >  >               <url-pattern>*.svc</url-pattern>
> >  > >  >       </servlet-mapping>
> >  > >  >
> >  > >  >
> >  > >  > The stack trace:
> >  > >  >
> >  > >  > 10:33:24.875 WARN!! [SocketListener0-0]
> >  > >  >
> >  >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590) >11>
> >  > >  >
> >  >
> /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
> >  > >  > org.hibernate.LazyInitializationException: failed to lazily
> >  > initialize a
> >  > >  > collection of role: com.company.User.roles, no session or
> session was
> >  > closed
> >  > >  >       at
> >  > >  >
> >  >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> >  > >  >       at
> >  > >  >
> >  >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> >  > >  >       at
> >  > >  >
> >  >
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> >  > >  >       at
> >  > >  >
> >  >
> org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
> >  > >  >       at
> >  > >  >
> >  >
> org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
> >  > >  >       at java.lang.String.valueOf(String.java:2615)
> >  > >  >       at java.lang.StringBuilder.append(StringBuilder.java:116)
> >  > >  >       at com.company.User.getAuthorities(User.java:209)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
> >  > >  >       at
> >  > >  >
> >  >
> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
> >  > >  >       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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> >  > >  >       at
> >  > >  >
> >  >
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> >  > >  >       at
> >  > >  >
> >  >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> >  > >  >       at
> org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> >  > >  >       at
> >  > >  >
> >  >
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> >  > >  >       at
> org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> >  > >  >       at
> org.mortbay.http.HttpServer.service(HttpServer.java:896)
> >  > >  >       at
> >  > org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> >  > >  >       at
> >  > org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> >  > >  >       at
> >  > org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> >  > >  >       at
> >  > >  >
> >  >
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> >  > >  >       at
> >  > org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> >  > >  >       at
> >  > org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> >  > >  >
> >  > >  > This happens on the default applications (quick start +
> security)
> >  > when
> >  > >  > using LAZY fetches on the role and trying to login as
> admin/admin.
> >  > >  >
> >  > >  >
> >  > >  > -------- Original-Nachricht --------
> >  > >  > > Datum: Wed, 30 Apr 2008 10:41:11 +0200
> >  > >  > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> >  > >  > > An: users@...
> >  > >  > > Betreff: Re: [trails-users] Lazy Fetches
> >  > >  >
> >  > >  > > I wasn't talking about 1.2, I was talking about doing a minor
> >  > update
> >  > >  > > over 1.1.1, releasing 1.1.2 with a patch for your issues.
> >  > >  > >
> >  > >  > > Ahhhh yes, I saw that with security, the problem is in the
> order of
> >  > >  > > the filters in the web.xml file.
> >  > >  > >
> >  > >  > > Try adding an "hibernateFilter" filter-mapping before the
> "Acegi
> >  > >  > > Filter Chain Proxy" filter-mapping
> >  > >  > >
> >  > >  > >     <!-- Added for Acegi support. -->
> >  > >  > >     <filter-mapping>
> >  > >  > >         <filter-name>hibernateFilter</filter-name>
> >  > >  > >         <url-pattern>/*</url-pattern>
> >  > >  > >     </filter-mapping>
> >  > >  > >
> >  > >  > >     <filter-mapping>
> >  > >  > >         <filter-name>Acegi Filter Chain Proxy</filter-name>
> >  > >  > >         <url-pattern>/*</url-pattern>
> >  > >  > >     </filter-mapping>
> >  > >  > >     <!--  Ended added for Acegi support. -->
> >  > >  > >
> >  > >  > >
> >  > >  > > Anyway, this could create another issue, it depends on how do
> you
> >  > >  > > manage the load/unload of your current user.
> >  > >  > > But let's deal with one problem at a time.
> >  > >  > > Try the above and let me know how it goes.
> >  > >  > >
> >  > >  > > Alejandro.
> >  > >  > >
> >  > >  > > --
> >  > >  > > Alejandro Scandroli - http://weblog.amneris.es/
> >  > >  > > Amneris: We build process-driven web applications.
> >  > >  > > http://www.amneris.es
> >  > >  > >
> >  > >  > >
> >  > >  > > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx
> >  > <superoverdrive@...>
> >  > >  > > wrote:
> >  > >  > > > Hi Alejandro!
> >  > >  > > >
> >  > >  > > >  I was using 1.1.1....I could also try out 1.1.2 (though
> 1.1.1
> >  > was
> >  > >  > still
> >  > >  > > the latest stable release).
> >  > >  > > >
> >  > >  > > >  Just do the quick start application using security and
> replace
> >  > EAGER
> >  > >  > by
> >  > >  > > LAZY and login as admin/admin.
> >  > >  > > >
> >  > >  > > >  HTTP ERROR: 500
> >  > >  > > >
> >  > >  > > >  failed to lazily initialize a collection of role:
> >  > sample.User.roles,
> >  > >  > no
> >  > >  > > session or session was closed
> >  > >  > > >
> >  > >  > > >  RequestURI=/j_acegi_security_check
> >  > >  > > >
> >  > >  > > >  Powered by Jetty://
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >  Tobias
> >  > >  > > >
> >  > >  > > >  -------- Original-Nachricht --------
> >  > >  > > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> >  > >  > > >  > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> >  > >  > > >
> >  > >  > > > > An: users@...
> >  > >  > > >  > Betreff: Re: [trails-users] Lazy Fetches
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >  > Hi Tobias
> >  > >  > > >  >
> >  > >  > > >  > As long as I know Trails doesn't force you to use EAGER
> >  > fetches.
> >  > >  > > >  > Can you give me more details about what problems are you
> >  > >  > > experiencing?
> >  > >  > > >  > I did a little test setting Car's Make and Model
> properties to
> >  > >  > LAZY,
> >  > >  > > >  > and I didn't get any exceptions.
> >  > >  > > >  > There is no problem in releasing a 1.1.2 version if we
> found
> >  > what
> >  > >  > the
> >  > >  > > >  > problem is.
> >  > >  > > >  >
> >  > >  > > >  >
> >  > >  > > >  > Alejandro.
> >  > >  > > >  >
> >  > >  > > >  >
> >  > >  > > >  > --
> >  > >  > > >  > Alejandro Scandroli - http://weblog.amneris.es/
> >  > >  > > >  > Amneris: We build process-driven web applications.
> >  > >  > > >  > http://www.amneris.es
> >  > >  > > >  >
> >  > >  > > >  >
> >  > >  > > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx
> >  > >  > <superoverdrive@...>
> >  > >  > > >  > wrote:
> >  > >  > > >  > > Would it be possible to support Lazy Fetches in trails
> 1.1?
> >  > (an
> >  > >  > > update?)
> >  > >  > > >  > >  Or would those changes take too long so the time is
> better
> >  > >  > > invested in
> >  > >  > > >  > working on trails 1.2 ?
> >  > >  > > >  > >
> >  > >  > > >  > >
> >  > >  > > >  > >
> >  > >  > >
> >  > ---------------------------------------------------------------------
> >  > >  > > >  > >  To unsubscribe from this list, please visit:
> >  > >  > > >  > >
> >  > >  > > >  > >     http://xircles.codehaus.org/manage_email
> >  > >  > > >  > >
> >  > >  > > >  > >
> >  > >  > > >  > >
> >  > >  > > >  >
> >  > >  > > >  >
> >  > >  >
> ---------------------------------------------------------------------
> >  > >  > > >  > To unsubscribe from this list, please visit:
> >  > >  > > >  >
> >  > >  > > >  >     http://xircles.codehaus.org/manage_email
> >  > >  > > >  >
> >  > >  > > >
> >  > >  > > >
> >  > ---------------------------------------------------------------------
> >  > >  > > >  To unsubscribe from this list, please visit:
> >  > >  > > >
> >  > >  > > >     http://xircles.codehaus.org/manage_email
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > >
> >  > >  > >
> >  > ---------------------------------------------------------------------
> >  > >  > > To unsubscribe from this list, please visit:
> >  > >  > >
> >  > >  > >     http://xircles.codehaus.org/manage_email
> >  > >  > >
> >  > >  >
> >  > >  >
> ---------------------------------------------------------------------
> >  > >  > To unsubscribe from this list, please visit:
> >  > >  >
> >  > >  >     http://xircles.codehaus.org/manage_email
> >  > >  >
> >  > >
> >  > >
> ---------------------------------------------------------------------
> >  > >  To unsubscribe from this list, please visit:
> >  > >
> >  > >     http://xircles.codehaus.org/manage_email
> >  > >
> >  > >
> >  > >
> >  >
> >  > ---------------------------------------------------------------------
> >  > To unsubscribe from this list, please visit:
> >  >
> >  >     http://xircles.codehaus.org/manage_email
> >  >
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Re: Lazy Fetches

by Toby78 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Could this not be part of the trails user factory that re-attach is automatically called?

Otherwise the page code gets more complex that it should......

I would like to keep the code as simple as possible and put all the complex stuff into re-usable libraries.....

Would be so easy to just call gtetCurrentUser() whereever and whenever you want.....

-------- Original-Nachricht --------
> Datum: Tue, 6 May 2008 06:09:08 -0700
> Von: "Kalle Korhonen" <kalle.o.korhonen@...>
> An: users@...
> Betreff: Re: [trails-users] Lazy Fetches

> On Tue, May 6, 2008 at 12:21 AM, Tobias Marx <superoverdrive@...>
> wrote:
>
> > Thanks!
> > Does this mean, you should in general never just use the getUser()
> method
> > on its own?
> > Seems like you can never be sure whether it is attched or detached?
> >
>
> I think you can always call reattach to make sure.
>
>
> > So what is the "good-practice" way of retrieving a user in general?
> >
>
> Keep login and user edit/more complex use cases separate. If you need user
> data for acegi and/or displaying welcome text or some such, implement
> UserSummary object that doesn't have association to other objects.
> Implement
> a a full User object with associations as a composite object or inherited,
> and retrieve it in the request only when you need it.
>
> Kalle
>
>
>
> > -------- Original-Nachricht --------
> > > Datum: Tue, 6 May 2008 00:45:02 +0200
> > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > > An: users@...
> > > Betreff: Re: [trails-users] Lazy Fetches
> >
> > > Hi Tobias
> > >
> > > This is what I was expecting when I said: this could create another
> > > issue, it depends on how do you
> > > manage the load/unload of your current user. But let's deal with one
> > > problem at a time.
> > >
> > > Your CurrentUserFactory configuration must be storing the currentUser
> > > in the session and that's why it's detached.
> > > I think your only option in this case is to reattach the currentUser
> > > to the current active hibernate session.
> > >
> > > Alejandro.
> > >
> > >
> > > On Mon, May 5, 2008 at 12:30 PM, Tobias Marx <superoverdrive@...>
> > > wrote:
> > > > Ok - with changing the filter order I could solve the Lazy
> > > initialization problem on the sample application.
> > > >
> > > >  When I copy this web.xml in a more complex web application, it does
> > > work with Lazy fetchs on most pages - but not all. I still get Lazy
> > > initialization exceptions on many pages.
> > > >
> > > >
> > > >
> > > >  12:23:50.281 ERROR! [SocketListener0-0]
> > >
> >
> org.hibernate.LazyInitializationException.<init>(LazyInitializationException.java:19)
> > >142> failed to
> > > lazily initialize a collection of role:
> > > com.company.dao.User.downloadedFeatures, no session or session was
> > closed
> > > >  org.hibernate.LazyInitializationException: failed to lazily
> > initialize
> > > a collection of role: com.company.dao.User.downloadedFeatures, no
> > session
> > > or session was closed
> > > >
> > > >         at
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> > > >         at
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> > > >         at
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
> > > >         at
> > > org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
> > > >         at java.util.ArrayList.<init>(ArrayList.java:133)
> > > >         at
> > >
> >
> org.apache.tapestry.coerce.CollectionToListConverter.convertValue(CollectionToListConverter.java:30)
> > > >         at
> > >
> >
> org.apache.tapestry.coerce.TypeConverterWrapper.convertValue(TypeConverterWrapper.java:65)
> > > >         at
> > >
> $TypeConverter_119b89ac71b.convertValue($TypeConverter_119b89ac71b.java)
> > > >         at
> > >
> $TypeConverter_119b89ac71a.convertValue($TypeConverter_119b89ac71a.java)
> > > >         at
> > >
> >
> org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(ValueConverterImpl.java:107)
> > > >         at
> > >
> >
> $ValueConverter_119b89ac58e.coerceValue($ValueConverter_119b89ac58e.java)
> > > >         at
> > >
> >
> org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:88)
> > > >         at
> > >
> >
> $DownloadedFeaturesObjectTable_16.getInstances($DownloadedFeaturesObjectTable_16.java)
> > > >         at
> > > org.trails.component.ObjectTable.getSource(ObjectTable.java:248)
> > > >         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:585)
> > > >         at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:768)
> > > >         at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1213)
> > > >         at
> > >
> >
> ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:60)
> > > >         at
> > >
> ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:144)
> > > >         at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1934)
> > > >         at ognl.ASTProperty.getValueBody(ASTProperty.java:109)
> > > >         at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:202)
> > > >         at ognl.SimpleNode.getValue(SimpleNode.java:246)
> > > >         at ognl.Ognl.getValue(Ognl.java:494)
> > > >         at ognl.Ognl.getValue(Ognl.java:458)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:153)
> > > >         at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
> > > >         at ognl.Ognl.compileExpression(Ognl.java:141)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheImpl.java:152)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression(ExpressionCacheImpl.java:115)
> > > >         at
> > >
> >
> $ExpressionCache_119b89ac6e9.getCompiledExpression($ExpressionCache_119b89ac6e9.java)
> > > >         at
> > >
> >
> org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBinding.java:134)
> > > >         at
> > >
> >
> org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java:125)
> > > >         at
> > >
> >
> org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:84)
> > > >         at $TableView_27.getSource($TableView_27.java)
> > > >         at
> > >
> >
> org.apache.tapestry.contrib.table.components.TableView.generateTableModel(TableView.java:255)
> > > >         at
> > >
> >
> org.apache.tapestry.contrib.table.components.TableViewSessionStateManager.recreateTableModel(TableViewSessionStateManager.java:65)
> > > >         at
> > >
> >
> org.apache.tapestry.contrib.table.components.TableView.getTableModel(TableView.java:212)
> > > >         at
> > >
> >
> org.apache.tapestry.contrib.table.components.TableView.validateValues(TableView.java:476)
> > > >         at
> > >
> >
> org.apache.tapestry.contrib.table.components.TableView.renderComponent(TableView.java:509)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> > > >         at
> > >
> >
> org.apache.tapestry.form.FormSupportImpl.render(FormSupportImpl.java:504)
> > > >         at
> > org.apache.tapestry.form.Form.renderComponent(Form.java:217)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> > > >         at
> > >
> >
> org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:39)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> > > >         at
> org.apache.tapestry.html.Body.renderComponent(Body.java:38)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:177)
> > > >         at
> > > org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:249)
> > > >         at
> > >
> >
> org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:397)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.renderResponse(DefaultResponseBuilder.java:151)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(ResponseRendererImpl.java:33)
> > > >         at
> > >
> >
> $ResponseRenderer_119b89ac5c0.renderResponse($ResponseRenderer_119b89ac5c0.java)
> > > >         at
> > > org.apache.tapestry.engine.PageService.service(PageService.java:68)
> > > >         at
> > > $IEngineService_119b89ac630.service($IEngineService_119b89ac630.java)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:72)
> > > >         at
> > >
> >
> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:241)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:54)
> > > >         at
> > >
> >
> $WebRequestServicer_119b89ac60c.service($WebRequestServicer_119b89ac60c.java)
> > > >         at
> org.trails.i18n.LocaleFilter.service(LocaleFilter.java:26)
> > > >         at
> > >
> >
> $WebRequestServicerFilter_119b89ac60a.service($WebRequestServicerFilter_119b89ac60a.java)
> > > >         at
> > >
> >
> $WebRequestServicer_119b89ac60e.service($WebRequestServicer_119b89ac60e.java)
> > > >         at
> > >
> >
> $WebRequestServicer_119b89ac606.service($WebRequestServicer_119b89ac606.java)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:61)
> > > >         at
> > >
> >
> $ServletRequestServicer_119b89ac5ec.service($ServletRequestServicer_119b89ac5ec.java)
> > > >         at
> > >
> >
> org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
> > > >         at
> > >
> >
> $ServletRequestServicerFilter_119b89ac5e8.service($ServletRequestServicerFilter_119b89ac5e8.java)
> > > >         at
> > >
> >
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> > > >         at
> > >
> >
> org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
> > > >         at
> > >
> >
> $ServletRequestServicerFilter_119b89ac5e6.service($ServletRequestServicerFilter_119b89ac5e6.java)
> > > >         at
> > >
> >
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
> > > >         at
> > >
> >
> $ServletRequestServicerFilter_119b89ac5ea.service($ServletRequestServicerFilter_119b89ac5ea.java)
> > > >         at
> > >
> >
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> > > >         at
> > >
> >
> $ServletRequestServicer_119b89ac5e0.service($ServletRequestServicer_119b89ac5e0.java)
> > > >         at
> > >
> >
> org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:126)
> > > >         at
> > >
> >
> org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:103)
> > > >         at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
> > > >         at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> > > >         at
> > > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:822)
> > > >         at
> > >
> >
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
> > > >
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > > >         at
> > > org.apache.tapestry.RedirectFilter.doFilter(RedirectFilter.java:103)
> > > >
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > > >         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.trails.security.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:152)
> > > >
> > > >         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.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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > > >         at
> > >
> >
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
> > > >         at
> > >
> >
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
> > > >
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> > > >         at
> > >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> > > >         at
> org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> > > >         at
> org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> > > >         at org.mortbay.http.HttpServer.service(HttpServer.java:896)
> > > >         at
> > > org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> > > >         at
> > > org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> > > >         at
> > > org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> > > >         at
> > >
> >
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> > > >         at
> > > org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> > > >         at
> > > org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> > > >
> > > >
> > > >  -------- Original-Nachricht --------
> > > >  > Datum: Mon, 5 May 2008 11:10:22 +0200
> > > >
> > > >
> > > > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > > >  > An: users@...
> > > >  > Betreff: Re: [trails-users] Lazy Fetches
> > > >
> > > >  > That's good, that's good, that means that the first "resource"
> your
> > > >  > browser is asking for is protected by acegi and that's why after
> > the
> > > >  > successful login it redirects you to it.
> > > >  > Add this rule to your "filterInvocationInterceptor" bean in
> > > >  > acegi-security.xml
> > > >  >
> > > >  > /assets/static/**/*.js=ROLE_ANONYMOUS,ROLE_USER
> > > >  >
> > > >  > Alejandro.
> > > >  >
> > > >  >
> > > >  >
> > > >  >
> > > >  >
> > > >  > On Mon, May 5, 2008 at 10:57 AM, Tobias Marx
> <superoverdrive@...
> > >
> > > >  > wrote:
> > > >  > > If I change the hibernate filter to /* instead of /app/* like
> in
> > > your
> > > >  > example, I am forwarded to:
> > > >  > >
> > > >  > >  http://localhost:8080/assets/static/tapestry/core.js
> > > >  > >
> > > >  > >  when I try to login.....
> > > >  > >
> > > >  > >
> > > >  > >  -------- Original-Nachricht --------
> > > >  > >  > Datum: Mon, 05 May 2008 10:37:06 +0200
> > > >  > >  > Von: "Tobias Marx" <superoverdrive@...>
> > > >  > >
> > > >  > >
> > > >  > > > An: users@...
> > > >  > >  > Betreff: Re: [trails-users] Lazy Fetches
> > > >  > >
> > > >  > >  > My web.xml looks like that:
> > > >  > >  >
> > > >  > >  >       <context-param>
> > > >  > >  >               <param-name>contextConfigLocation</param-name>
> > > >  > >  >               <param-value>
> > > >  > >  >                       classpath:applicationContext.xml
> > > >  > >  >                       classpath:acegi-security.xml
> > > >  > >  >
> > classpath:applicationContext-seedData.xml
> > > >  > >  >               </param-value>
> > > >  > >  >       </context-param>
> > > >  > >  >
> > > >  > >  >       <!-- Spring Open Session In View Pattern filter -->
> > > >  > >  >       <filter>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <filter-class>
> > > >  > >  >
> > > >  >
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> > > >  > >  >               </filter-class>
> > > >  > >  >       </filter>
> > > >  > >  >
> > > >  > >  >
> > > >  > >  >       <!-- Added for Acegi support. -->
> > > >  > >  >       <filter>
> > > >  > >  >               <filter-name>Acegi Filter Chain
> > > Proxy</filter-name>
> > > >  > >  >               <filter-class>
> > > >  > >  >                      
> org.acegisecurity.util.FilterToBeanProxy
> > > >  > >  >               </filter-class>
> > > >  > >  >               <init-param>
> > > >  > >  >                       <param-name>targetClass</param-name>
> > > >  > >  >                       <param-value>
> > > >  > >  >
> > > org.acegisecurity.util.FilterChainProxy
> > > >  > >  >                       </param-value>
> > > >  > >  >               </init-param>
> > > >  > >  >       </filter>
> > > >  > >  >       <!-- Ended added for Acegi support. -->
> > > >  > >  >
> > > >  > >  >       <filter>
> > > >  > >  >               <filter-name>redirect</filter-name>
> > > >  > >  >
> > > >  > <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
> > > >  > >  >       </filter>
> > > >  > >  >
> > > >  > >  >
> > > >  > >  >       <!-- Added for Acegi support. -->
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>Acegi Filter Chain
> > > Proxy</filter-name>
> > > >  > >  >               <url-pattern>/*</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >       <!--  Ended added for Acegi support. -->
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>redirect</filter-name>
> > > >  > >  >               <url-pattern>/</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <!-- Spring/Hibernate filter mappings -->
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>/app/*</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>/app</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>*.page</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>*.direct</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>*.sdirect</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>/assets/*</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>*.svc</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <listener>
> > > >  > >  >
> > > >  >
> > >
> >
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> > > >  > >  >       </listener>
> > > >  > >  >       <servlet>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >
> > > >  >
> > >
> >
> <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
> > > >  > >  >               <load-on-startup>1</load-on-startup>
> > > >  > >  >       </servlet>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>/app</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>*.page</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>*.direct</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>*.sdirect</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>/assets/*</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>*.svc</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >
> > > >  > >  > The stack trace:
> > > >  > >  >
> > > >  > >  > 10:33:24.875 WARN!! [SocketListener0-0]
> > > >  > >  >
> > > >  >
> > >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590)
> > >11>
> > > >  > >  >
> > > >  >
> > >
> >
> /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
> > > >  > >  > org.hibernate.LazyInitializationException: failed to lazily
> > > >  > initialize a
> > > >  > >  > collection of role: com.company.User.roles, no session or
> > > session was
> > > >  > closed
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
> > > >  > >  >       at java.lang.String.valueOf(String.java:2615)
> > > >  > >  >       at
> > java.lang.StringBuilder.append(StringBuilder.java:116)
> > > >  > >  >       at com.company.User.getAuthorities(User.java:209)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
> > > >  > >  >       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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> > > >  > >  >       at
> > > org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> > > >  > >  >       at
> > > org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> > > >  > >  >       at
> > > org.mortbay.http.HttpServer.service(HttpServer.java:896)
> > > >  > >  >       at
> > > >  > org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> > > >  > >  >       at
> > > >  >
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> > > >  > >  >       at
> > > >  > org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> > > >  > >  >       at
> > > >  > org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> > > >  > >  >       at
> > > >  > org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> > > >  > >  >
> > > >  > >  > This happens on the default applications (quick start +
> > > security)
> > > >  > when
> > > >  > >  > using LAZY fetches on the role and trying to login as
> > > admin/admin.
> > > >  > >  >
> > > >  > >  >
> > > >  > >  > -------- Original-Nachricht --------
> > > >  > >  > > Datum: Wed, 30 Apr 2008 10:41:11 +0200
> > > >  > >  > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > > >  > >  > > An: users@...
> > > >  > >  > > Betreff: Re: [trails-users] Lazy Fetches
> > > >  > >  >
> > > >  > >  > > I wasn't talking about 1.2, I was talking about doing a
> > minor
> > > >  > update
> > > >  > >  > > over 1.1.1, releasing 1.1.2 with a patch for your issues.
> > > >  > >  > >
> > > >  > >  > > Ahhhh yes, I saw that with security, the problem is in the
> > > order of
> > > >  > >  > > the filters in the web.xml file.
> > > >  > >  > >
> > > >  > >  > > Try adding an "hibernateFilter" filter-mapping before the
> > > "Acegi
> > > >  > >  > > Filter Chain Proxy" filter-mapping
> > > >  > >  > >
> > > >  > >  > >     <!-- Added for Acegi support. -->
> > > >  > >  > >     <filter-mapping>
> > > >  > >  > >         <filter-name>hibernateFilter</filter-name>
> > > >  > >  > >         <url-pattern>/*</url-pattern>
> > > >  > >  > >     </filter-mapping>
> > > >  > >  > >
> > > >  > >  > >     <filter-mapping>
> > > >  > >  > >         <filter-name>Acegi Filter Chain
> Proxy</filter-name>
> > > >  > >  > >         <url-pattern>/*</url-pattern>
> > > >  > >  > >     </filter-mapping>
> > > >  > >  > >     <!--  Ended added for Acegi support. -->
> > > >  > >  > >
> > > >  > >  > >
> > > >  > >  > > Anyway, this could create another issue, it depends on how
> > do
> > > you
> > > >  > >  > > manage the load/unload of your current user.
> > > >  > >  > > But let's deal with one problem at a time.
> > > >  > >  > > Try the above and let me know how it goes.
> > > >  > >  > >
> > > >  > >  > > Alejandro.
> > > >  > >  > >
> > > >  > >  > > --
> > > >  > >  > > Alejandro Scandroli - http://weblog.amneris.es/
> > > >  > >  > > Amneris: We build process-driven web applications.
> > > >  > >  > > http://www.amneris.es
> > > >  > >  > >
> > > >  > >  > >
> > > >  > >  > > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx
> > > >  > <superoverdrive@...>
> > > >  > >  > > wrote:
> > > >  > >  > > > Hi Alejandro!
> > > >  > >  > > >
> > > >  > >  > > >  I was using 1.1.1....I could also try out 1.1.2 (though
> > > 1.1.1
> > > >  > was
> > > >  > >  > still
> > > >  > >  > > the latest stable release).
> > > >  > >  > > >
> > > >  > >  > > >  Just do the quick start application using security and
> > > replace
> > > >  > EAGER
> > > >  > >  > by
> > > >  > >  > > LAZY and login as admin/admin.
> > > >  > >  > > >
> > > >  > >  > > >  HTTP ERROR: 500
> > > >  > >  > > >
> > > >  > >  > > >  failed to lazily initialize a collection of role:
> > > >  > sample.User.roles,
> > > >  > >  > no
> > > >  > >  > > session or session was closed
> > > >  > >  > > >
> > > >  > >  > > >  RequestURI=/j_acegi_security_check
> > > >  > >  > > >
> > > >  > >  > > >  Powered by Jetty://
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > > >  Tobias
> > > >  > >  > > >
> > > >  > >  > > >  -------- Original-Nachricht --------
> > > >  > >  > > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> > > >  > >  > > >  > Von: "Alejandro Scandroli" <
> > alejandroscandroli@...>
> > > >  > >  > > >
> > > >  > >  > > > > An: users@...
> > > >  > >  > > >  > Betreff: Re: [trails-users] Lazy Fetches
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > > >  > Hi Tobias
> > > >  > >  > > >  >
> > > >  > >  > > >  > As long as I know Trails doesn't force you to use
> EAGER
> > > >  > fetches.
> > > >  > >  > > >  > Can you give me more details about what problems are
> > you
> > > >  > >  > > experiencing?
> > > >  > >  > > >  > I did a little test setting Car's Make and Model
> > > properties to
> > > >  > >  > LAZY,
> > > >  > >  > > >  > and I didn't get any exceptions.
> > > >  > >  > > >  > There is no problem in releasing a 1.1.2 version if
> we
> > > found
> > > >  > what
> > > >  > >  > the
> > > >  > >  > > >  > problem is.
> > > >  > >  > > >  >
> > > >  > >  > > >  >
> > > >  > >  > > >  > Alejandro.
> > > >  > >  > > >  >
> > > >  > >  > > >  >
> > > >  > >  > > >  > --
> > > >  > >  > > >  > Alejandro Scandroli - http://weblog.amneris.es/
> > > >  > >  > > >  > Amneris: We build process-driven web applications.
> > > >  > >  > > >  > http://www.amneris.es
> > > >  > >  > > >  >
> > > >  > >  > > >  >
> > > >  > >  > > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx
> > > >  > >  > <superoverdrive@...>
> > > >  > >  > > >  > wrote:
> > > >  > >  > > >  > > Would it be possible to support Lazy Fetches in
> > trails
> > > 1.1?
> > > >  > (an
> > > >  > >  > > update?)
> > > >  > >  > > >  > >  Or would those changes take too long so the time
> is
> > > better
> > > >  > >  > > invested in
> > > >  > >  > > >  > working on trails 1.2 ?
> > > >  > >  > > >  > >
> > > >  > >  > > >  > >
> > > >  > >  > > >  > >
> > > >  > >  > >
> > > >  >
> > ---------------------------------------------------------------------
> > > >  > >  > > >  > >  To unsubscribe from this list, please visit:
> > > >  > >  > > >  > >
> > > >  > >  > > >  > >     http://xircles.codehaus.org/manage_email
> > > >  > >  > > >  > >
> > > >  > >  > > >  > >
> > > >  > >  > > >  > >
> > > >  > >  > > >  >
> > > >  > >  > > >  >
> > > >  > >  >
> > > ---------------------------------------------------------------------
> > > >  > >  > > >  > To unsubscribe from this list, please visit:
> > > >  > >  > > >  >
> > > >  > >  > > >  >     http://xircles.codehaus.org/manage_email
> > > >  > >  > > >  >
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  >
> > ---------------------------------------------------------------------
> > > >  > >  > > >  To unsubscribe from this list, please visit:
> > > >  > >  > > >
> > > >  > >  > > >     http://xircles.codehaus.org/manage_email
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > >
> > > >  > >  > >
> > > >  >
> > ---------------------------------------------------------------------
> > > >  > >  > > To unsubscribe from this list, please visit:
> > > >  > >  > >
> > > >  > >  > >     http://xircles.codehaus.org/manage_email
> > > >  > >  > >
> > > >  > >  >
> > > >  > >  >
> > > ---------------------------------------------------------------------
> > > >  > >  > To unsubscribe from this list, please visit:
> > > >  > >  >
> > > >  > >  >     http://xircles.codehaus.org/manage_email
> > > >  > >  >
> > > >  > >
> > > >  > >
> > > ---------------------------------------------------------------------
> > > >  > >  To unsubscribe from this list, please visit:
> > > >  > >
> > > >  > >     http://xircles.codehaus.org/manage_email
> > > >  > >
> > > >  > >
> > > >  > >
> > > >  >
> > > >  >
> > ---------------------------------------------------------------------
> > > >  > To unsubscribe from this list, please visit:
> > > >  >
> > > >  >     http://xircles.codehaus.org/manage_email
> > > >  >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > >  To unsubscribe from this list, please visit:
> > > >
> > > >     http://xircles.codehaus.org/manage_email
> > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe from this list, please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
> >
> >

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Lazy Fetches

by Toby78 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Would this work ?
       
        public void pageBeginRender(PageEvent event)
        {

                if (getCurrentUser()==null){
                        throw new PageRedirectException(event.getRequestCycle().getPage("Home"));
                }
               
                HibernatePersistenceService service = (HibernatePersistenceService) this.getPersistenceService();
                service.reattach(getCurrentUser());
               
               
          }

This is a method inside of a BasePage every page uses....

-------- Original-Nachricht --------
> Datum: Tue, 6 May 2008 06:09:08 -0700
> Von: "Kalle Korhonen" <kalle.o.korhonen@...>
> An: users@...
> Betreff: Re: [trails-users] Lazy Fetches

> On Tue, May 6, 2008 at 12:21 AM, Tobias Marx <superoverdrive@...>
> wrote:
>
> > Thanks!
> > Does this mean, you should in general never just use the getUser()
> method
> > on its own?
> > Seems like you can never be sure whether it is attched or detached?
> >
>
> I think you can always call reattach to make sure.
>
>
> > So what is the "good-practice" way of retrieving a user in general?
> >
>
> Keep login and user edit/more complex use cases separate. If you need user
> data for acegi and/or displaying welcome text or some such, implement
> UserSummary object that doesn't have association to other objects.
> Implement
> a a full User object with associations as a composite object or inherited,
> and retrieve it in the request only when you need it.
>
> Kalle
>
>
>
> > -------- Original-Nachricht --------
> > > Datum: Tue, 6 May 2008 00:45:02 +0200
> > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > > An: users@...
> > > Betreff: Re: [trails-users] Lazy Fetches
> >
> > > Hi Tobias
> > >
> > > This is what I was expecting when I said: this could create another
> > > issue, it depends on how do you
> > > manage the load/unload of your current user. But let's deal with one
> > > problem at a time.
> > >
> > > Your CurrentUserFactory configuration must be storing the currentUser
> > > in the session and that's why it's detached.
> > > I think your only option in this case is to reattach the currentUser
> > > to the current active hibernate session.
> > >
> > > Alejandro.
> > >
> > >
> > > On Mon, May 5, 2008 at 12:30 PM, Tobias Marx <superoverdrive@...>
> > > wrote:
> > > > Ok - with changing the filter order I could solve the Lazy
> > > initialization problem on the sample application.
> > > >
> > > >  When I copy this web.xml in a more complex web application, it does
> > > work with Lazy fetchs on most pages - but not all. I still get Lazy
> > > initialization exceptions on many pages.
> > > >
> > > >
> > > >
> > > >  12:23:50.281 ERROR! [SocketListener0-0]
> > >
> >
> org.hibernate.LazyInitializationException.<init>(LazyInitializationException.java:19)
> > >142> failed to
> > > lazily initialize a collection of role:
> > > com.company.dao.User.downloadedFeatures, no session or session was
> > closed
> > > >  org.hibernate.LazyInitializationException: failed to lazily
> > initialize
> > > a collection of role: com.company.dao.User.downloadedFeatures, no
> > session
> > > or session was closed
> > > >
> > > >         at
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> > > >         at
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> > > >         at
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
> > > >         at
> > > org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
> > > >         at java.util.ArrayList.<init>(ArrayList.java:133)
> > > >         at
> > >
> >
> org.apache.tapestry.coerce.CollectionToListConverter.convertValue(CollectionToListConverter.java:30)
> > > >         at
> > >
> >
> org.apache.tapestry.coerce.TypeConverterWrapper.convertValue(TypeConverterWrapper.java:65)
> > > >         at
> > >
> $TypeConverter_119b89ac71b.convertValue($TypeConverter_119b89ac71b.java)
> > > >         at
> > >
> $TypeConverter_119b89ac71a.convertValue($TypeConverter_119b89ac71a.java)
> > > >         at
> > >
> >
> org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(ValueConverterImpl.java:107)
> > > >         at
> > >
> >
> $ValueConverter_119b89ac58e.coerceValue($ValueConverter_119b89ac58e.java)
> > > >         at
> > >
> >
> org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:88)
> > > >         at
> > >
> >
> $DownloadedFeaturesObjectTable_16.getInstances($DownloadedFeaturesObjectTable_16.java)
> > > >         at
> > > org.trails.component.ObjectTable.getSource(ObjectTable.java:248)
> > > >         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:585)
> > > >         at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:768)
> > > >         at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1213)
> > > >         at
> > >
> >
> ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:60)
> > > >         at
> > >
> ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:144)
> > > >         at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1934)
> > > >         at ognl.ASTProperty.getValueBody(ASTProperty.java:109)
> > > >         at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:202)
> > > >         at ognl.SimpleNode.getValue(SimpleNode.java:246)
> > > >         at ognl.Ognl.getValue(Ognl.java:494)
> > > >         at ognl.Ognl.getValue(Ognl.java:458)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:153)
> > > >         at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
> > > >         at ognl.Ognl.compileExpression(Ognl.java:141)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheImpl.java:152)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression(ExpressionCacheImpl.java:115)
> > > >         at
> > >
> >
> $ExpressionCache_119b89ac6e9.getCompiledExpression($ExpressionCache_119b89ac6e9.java)
> > > >         at
> > >
> >
> org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBinding.java:134)
> > > >         at
> > >
> >
> org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java:125)
> > > >         at
> > >
> >
> org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:84)
> > > >         at $TableView_27.getSource($TableView_27.java)
> > > >         at
> > >
> >
> org.apache.tapestry.contrib.table.components.TableView.generateTableModel(TableView.java:255)
> > > >         at
> > >
> >
> org.apache.tapestry.contrib.table.components.TableViewSessionStateManager.recreateTableModel(TableViewSessionStateManager.java:65)
> > > >         at
> > >
> >
> org.apache.tapestry.contrib.table.components.TableView.getTableModel(TableView.java:212)
> > > >         at
> > >
> >
> org.apache.tapestry.contrib.table.components.TableView.validateValues(TableView.java:476)
> > > >         at
> > >
> >
> org.apache.tapestry.contrib.table.components.TableView.renderComponent(TableView.java:509)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> > > >         at
> > >
> >
> org.apache.tapestry.form.FormSupportImpl.render(FormSupportImpl.java:504)
> > > >         at
> > org.apache.tapestry.form.Form.renderComponent(Form.java:217)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> > > >         at
> > >
> >
> org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:39)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:539)
> > > >         at
> org.apache.tapestry.html.Body.renderComponent(Body.java:38)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:179)
> > > >         at
> > >
> >
> org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:107)
> > > >         at
> > >
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:725)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:177)
> > > >         at
> > > org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:249)
> > > >         at
> > >
> >
> org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:397)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.DefaultResponseBuilder.renderResponse(DefaultResponseBuilder.java:151)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(ResponseRendererImpl.java:33)
> > > >         at
> > >
> >
> $ResponseRenderer_119b89ac5c0.renderResponse($ResponseRenderer_119b89ac5c0.java)
> > > >         at
> > > org.apache.tapestry.engine.PageService.service(PageService.java:68)
> > > >         at
> > > $IEngineService_119b89ac630.service($IEngineService_119b89ac630.java)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:72)
> > > >         at
> > >
> >
> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:241)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:54)
> > > >         at
> > >
> >
> $WebRequestServicer_119b89ac60c.service($WebRequestServicer_119b89ac60c.java)
> > > >         at
> org.trails.i18n.LocaleFilter.service(LocaleFilter.java:26)
> > > >         at
> > >
> >
> $WebRequestServicerFilter_119b89ac60a.service($WebRequestServicerFilter_119b89ac60a.java)
> > > >         at
> > >
> >
> $WebRequestServicer_119b89ac60e.service($WebRequestServicer_119b89ac60e.java)
> > > >         at
> > >
> >
> $WebRequestServicer_119b89ac606.service($WebRequestServicer_119b89ac606.java)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:61)
> > > >         at
> > >
> >
> $ServletRequestServicer_119b89ac5ec.service($ServletRequestServicer_119b89ac5ec.java)
> > > >         at
> > >
> >
> org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
> > > >         at
> > >
> >
> $ServletRequestServicerFilter_119b89ac5e8.service($ServletRequestServicerFilter_119b89ac5e8.java)
> > > >         at
> > >
> >
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> > > >         at
> > >
> >
> org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
> > > >         at
> > >
> >
> $ServletRequestServicerFilter_119b89ac5e6.service($ServletRequestServicerFilter_119b89ac5e6.java)
> > > >         at
> > >
> >
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> > > >         at
> > >
> >
> org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
> > > >         at
> > >
> >
> $ServletRequestServicerFilter_119b89ac5ea.service($ServletRequestServicerFilter_119b89ac5ea.java)
> > > >         at
> > >
> >
> $ServletRequestServicer_119b89ac5ee.service($ServletRequestServicer_119b89ac5ee.java)
> > > >         at
> > >
> >
> $ServletRequestServicer_119b89ac5e0.service($ServletRequestServicer_119b89ac5e0.java)
> > > >         at
> > >
> >
> org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:126)
> > > >         at
> > >
> >
> org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:103)
> > > >         at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
> > > >         at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> > > >         at
> > > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:822)
> > > >         at
> > >
> >
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
> > > >
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > > >         at
> > > org.apache.tapestry.RedirectFilter.doFilter(RedirectFilter.java:103)
> > > >
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > > >         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.trails.security.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:152)
> > > >
> > > >         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.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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > > >         at
> > >
> >
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
> > > >         at
> > >
> >
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
> > > >
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> > > >         at
> > >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> > > >         at
> org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> > > >         at
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> > > >         at
> org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> > > >         at org.mortbay.http.HttpServer.service(HttpServer.java:896)
> > > >         at
> > > org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> > > >         at
> > > org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> > > >         at
> > > org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> > > >         at
> > >
> >
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> > > >         at
> > > org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> > > >         at
> > > org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> > > >
> > > >
> > > >  -------- Original-Nachricht --------
> > > >  > Datum: Mon, 5 May 2008 11:10:22 +0200
> > > >
> > > >
> > > > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > > >  > An: users@...
> > > >  > Betreff: Re: [trails-users] Lazy Fetches
> > > >
> > > >  > That's good, that's good, that means that the first "resource"
> your
> > > >  > browser is asking for is protected by acegi and that's why after
> > the
> > > >  > successful login it redirects you to it.
> > > >  > Add this rule to your "filterInvocationInterceptor" bean in
> > > >  > acegi-security.xml
> > > >  >
> > > >  > /assets/static/**/*.js=ROLE_ANONYMOUS,ROLE_USER
> > > >  >
> > > >  > Alejandro.
> > > >  >
> > > >  >
> > > >  >
> > > >  >
> > > >  >
> > > >  > On Mon, May 5, 2008 at 10:57 AM, Tobias Marx
> <superoverdrive@...
> > >
> > > >  > wrote:
> > > >  > > If I change the hibernate filter to /* instead of /app/* like
> in
> > > your
> > > >  > example, I am forwarded to:
> > > >  > >
> > > >  > >  http://localhost:8080/assets/static/tapestry/core.js
> > > >  > >
> > > >  > >  when I try to login.....
> > > >  > >
> > > >  > >
> > > >  > >  -------- Original-Nachricht --------
> > > >  > >  > Datum: Mon, 05 May 2008 10:37:06 +0200
> > > >  > >  > Von: "Tobias Marx" <superoverdrive@...>
> > > >  > >
> > > >  > >
> > > >  > > > An: users@...
> > > >  > >  > Betreff: Re: [trails-users] Lazy Fetches
> > > >  > >
> > > >  > >  > My web.xml looks like that:
> > > >  > >  >
> > > >  > >  >       <context-param>
> > > >  > >  >               <param-name>contextConfigLocation</param-name>
> > > >  > >  >               <param-value>
> > > >  > >  >                       classpath:applicationContext.xml
> > > >  > >  >                       classpath:acegi-security.xml
> > > >  > >  >
> > classpath:applicationContext-seedData.xml
> > > >  > >  >               </param-value>
> > > >  > >  >       </context-param>
> > > >  > >  >
> > > >  > >  >       <!-- Spring Open Session In View Pattern filter -->
> > > >  > >  >       <filter>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <filter-class>
> > > >  > >  >
> > > >  >
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> > > >  > >  >               </filter-class>
> > > >  > >  >       </filter>
> > > >  > >  >
> > > >  > >  >
> > > >  > >  >       <!-- Added for Acegi support. -->
> > > >  > >  >       <filter>
> > > >  > >  >               <filter-name>Acegi Filter Chain
> > > Proxy</filter-name>
> > > >  > >  >               <filter-class>
> > > >  > >  >                      
> org.acegisecurity.util.FilterToBeanProxy
> > > >  > >  >               </filter-class>
> > > >  > >  >               <init-param>
> > > >  > >  >                       <param-name>targetClass</param-name>
> > > >  > >  >                       <param-value>
> > > >  > >  >
> > > org.acegisecurity.util.FilterChainProxy
> > > >  > >  >                       </param-value>
> > > >  > >  >               </init-param>
> > > >  > >  >       </filter>
> > > >  > >  >       <!-- Ended added for Acegi support. -->
> > > >  > >  >
> > > >  > >  >       <filter>
> > > >  > >  >               <filter-name>redirect</filter-name>
> > > >  > >  >
> > > >  > <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
> > > >  > >  >       </filter>
> > > >  > >  >
> > > >  > >  >
> > > >  > >  >       <!-- Added for Acegi support. -->
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>Acegi Filter Chain
> > > Proxy</filter-name>
> > > >  > >  >               <url-pattern>/*</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >       <!--  Ended added for Acegi support. -->
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>redirect</filter-name>
> > > >  > >  >               <url-pattern>/</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <!-- Spring/Hibernate filter mappings -->
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>/app/*</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>/app</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>*.page</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>*.direct</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>*.sdirect</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>/assets/*</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <filter-mapping>
> > > >  > >  >               <filter-name>hibernateFilter</filter-name>
> > > >  > >  >               <url-pattern>*.svc</url-pattern>
> > > >  > >  >       </filter-mapping>
> > > >  > >  >
> > > >  > >  >       <listener>
> > > >  > >  >
> > > >  >
> > >
> >
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> > > >  > >  >       </listener>
> > > >  > >  >       <servlet>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >
> > > >  >
> > >
> >
> <servlet-class>org.trails.servlet.TrailsApplicationServlet</servlet-class>
> > > >  > >  >               <load-on-startup>1</load-on-startup>
> > > >  > >  >       </servlet>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>/app</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>*.page</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>*.direct</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>*.sdirect</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>/assets/*</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >       <servlet-mapping>
> > > >  > >  >               <servlet-name>trails</servlet-name>
> > > >  > >  >               <url-pattern>*.svc</url-pattern>
> > > >  > >  >       </servlet-mapping>
> > > >  > >  >
> > > >  > >  >
> > > >  > >  > The stack trace:
> > > >  > >  >
> > > >  > >  > 10:33:24.875 WARN!! [SocketListener0-0]
> > > >  > >  >
> > > >  >
> > >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:590)
> > >11>
> > > >  > >  >
> > > >  >
> > >
> >
> /j_acegi_security_check?j_username=admin&j_password=admin&j_rememberme=false:
> > > >  > >  > org.hibernate.LazyInitializationException: failed to lazily
> > > >  > initialize a
> > > >  > >  > collection of role: com.company.User.roles, no session or
> > > session was
> > > >  > closed
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
> > > >  > >  >       at java.lang.String.valueOf(String.java:2615)
> > > >  > >  >       at
> > java.lang.StringBuilder.append(StringBuilder.java:116)
> > > >  > >  >       at com.company.User.getAuthorities(User.java:209)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.createSuccessAuthentication(AbstractUserDetailsAuthenticationProvider.java:199)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:178)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:45)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:71)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:211)
> > > >  > >  >       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.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:813)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
> > > >  > >  >       at
> > > org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
> > > >  > >  >       at
> > > org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
> > > >  > >  >       at
> > > org.mortbay.http.HttpServer.service(HttpServer.java:896)
> > > >  > >  >       at
> > > >  > org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
> > > >  > >  >       at
> > > >  >
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
> > > >  > >  >       at
> > > >  > org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
> > > >  > >  >       at
> > > >  > >  >
> > > >  >
> > >
> >
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> > > >  > >  >       at
> > > >  > org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
> > > >  > >  >       at
> > > >  > org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> > > >  > >  >
> > > >  > >  > This happens on the default applications (quick start +
> > > security)
> > > >  > when
> > > >  > >  > using LAZY fetches on the role and trying to login as
> > > admin/admin.
> > > >  > >  >
> > > >  > >  >
> > > >  > >  > -------- Original-Nachricht --------
> > > >  > >  > > Datum: Wed, 30 Apr 2008 10:41:11 +0200
> > > >  > >  > > Von: "Alejandro Scandroli" <alejandroscandroli@...>
> > > >  > >  > > An: users@...
> > > >  > >  > > Betreff: Re: [trails-users] Lazy Fetches
> > > >  > >  >
> > > >  > >  > > I wasn't talking about 1.2, I was talking about doing a
> > minor
> > > >  > update
> > > >  > >  > > over 1.1.1, releasing 1.1.2 with a patch for your issues.
> > > >  > >  > >
> > > >  > >  > > Ahhhh yes, I saw that with security, the problem is in the
> > > order of
> > > >  > >  > > the filters in the web.xml file.
> > > >  > >  > >
> > > >  > >  > > Try adding an "hibernateFilter" filter-mapping before the
> > > "Acegi
> > > >  > >  > > Filter Chain Proxy" filter-mapping
> > > >  > >  > >
> > > >  > >  > >     <!-- Added for Acegi support. -->
> > > >  > >  > >     <filter-mapping>
> > > >  > >  > >         <filter-name>hibernateFilter</filter-name>
> > > >  > >  > >         <url-pattern>/*</url-pattern>
> > > >  > >  > >     </filter-mapping>
> > > >  > >  > >
> > > >  > >  > >     <filter-mapping>
> > > >  > >  > >         <filter-name>Acegi Filter Chain
> Proxy</filter-name>
> > > >  > >  > >         <url-pattern>/*</url-pattern>
> > > >  > >  > >     </filter-mapping>
> > > >  > >  > >     <!--  Ended added for Acegi support. -->
> > > >  > >  > >
> > > >  > >  > >
> > > >  > >  > > Anyway, this could create another issue, it depends on how
> > do
> > > you
> > > >  > >  > > manage the load/unload of your current user.
> > > >  > >  > > But let's deal with one problem at a time.
> > > >  > >  > > Try the above and let me know how it goes.
> > > >  > >  > >
> > > >  > >  > > Alejandro.
> > > >  > >  > >
> > > >  > >  > > --
> > > >  > >  > > Alejandro Scandroli - http://weblog.amneris.es/
> > > >  > >  > > Amneris: We build process-driven web applications.
> > > >  > >  > > http://www.amneris.es
> > > >  > >  > >
> > > >  > >  > >
> > > >  > >  > > On Wed, Apr 30, 2008 at 10:26 AM, Tobias Marx
> > > >  > <superoverdrive@...>
> > > >  > >  > > wrote:
> > > >  > >  > > > Hi Alejandro!
> > > >  > >  > > >
> > > >  > >  > > >  I was using 1.1.1....I could also try out 1.1.2 (though
> > > 1.1.1
> > > >  > was
> > > >  > >  > still
> > > >  > >  > > the latest stable release).
> > > >  > >  > > >
> > > >  > >  > > >  Just do the quick start application using security and
> > > replace
> > > >  > EAGER
> > > >  > >  > by
> > > >  > >  > > LAZY and login as admin/admin.
> > > >  > >  > > >
> > > >  > >  > > >  HTTP ERROR: 500
> > > >  > >  > > >
> > > >  > >  > > >  failed to lazily initialize a collection of role:
> > > >  > sample.User.roles,
> > > >  > >  > no
> > > >  > >  > > session or session was closed
> > > >  > >  > > >
> > > >  > >  > > >  RequestURI=/j_acegi_security_check
> > > >  > >  > > >
> > > >  > >  > > >  Powered by Jetty://
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > > >  Tobias
> > > >  > >  > > >
> > > >  > >  > > >  -------- Original-Nachricht --------
> > > >  > >  > > >  > Datum: Wed, 30 Apr 2008 10:00:36 +0200
> > > >  > >  > > >  > Von: "Alejandro Scandroli" <
> > alejandroscandroli@...>
> > > >  > >  > > >
> > > >  > >  > > > > An: users@...
> > > >  > >  > > >  > Betreff: Re: [trails-users] Lazy Fetches
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > > >  > Hi Tobias
> > > >  > >  > > >  >
> > > >  > >  > > >  > As long as I know Trails doesn't force you to use
> EAGER
> > > >  > fetches.
> > > >  > >  > > >  > Can you give me more details about what problems are
> > you
> > > >  > >  > > experiencing?
> > > >  > >  > > >  > I did a little test setting Car's Make and Model
> > > properties to
> > > >  > >  > LAZY,
> > > >  > >  > > >  > and I didn't get any exceptions.
> > > >  > >  > > >  > There is no problem in releasing a 1.1.2 version if
> we
> > > found
> > > >  > what
> > > >  > >  > the
> > > >  > >  > > >  > problem is.
> > > >  > >  > > >  >
> > > >  > >  > > >  >
> > > >  > >  > > >  > Alejandro.
> > > >  > >  > > >  >
> > > >  > >  > > >  >
> > > >  > >  > > >  > --
> > > >  > >  > > >  > Alejandro Scandroli - http://weblog.amneris.es/
> > > >  > >  > > >  > Amneris: We build process-driven web applications.
> > > >  > >  > > >  > http://www.amneris.es
> > > >  > >  > > >  >
> > > >  > >  > > >  >
> > > >  > >  > > >  > On Tue, Apr 29, 2008 at 12:45 PM, Tobias Marx
> > > >  > >  > <superoverdrive@...>
> > > >  > >  > > >  > wrote:
> > > >  > >  > > >  > > Would it be possible to support Lazy Fetches in
> > trails
> > > 1.1?
> > > >  > (an
> > > >  > >  > > update?)
> > > >  > >  > > >  > >  Or would those changes take too long so the time
> is
> > > better
> > > >  > >  > > invested in
> > > >  > >  > > >  > working on trails 1.2 ?
> > > >  > >  > > >  > >
> > > >  > >  > > >  > >
> > > >  > >  > > >  > >
> > > >  > >  > >
> > > >  >
> > ---------------------------------------------------------------------
> > > >  > >  > > >  > >  To unsubscribe from this list, please visit:
> > > >  > >  > > >  > >
> > > >  > >  > > >  > >     http://xircles.codehaus.org/manage_email
> > > >  > >  > > >  > >
> > > >  > >  > > >  > >
> > > >  > >  > > >  > >
> > > >  > >  > > >  >
> > > >  > >  > > >  >
> > > >  > >  >
> > > ---------------------------------------------------------------------
> > > >  > >  > > >  > To unsubscribe from this list, please visit:
> > > >  > >  > > >  >
> > > >  > >  > > >  >     http://xircles.codehaus.org/manage_email
> > > >  > >  > > >  >
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  >
> > ---------------------------------------------------------------------
> > > >  > >  > > >  To unsubscribe from this list, please visit:
> > > >  > >  > > >
> > > >  > >  > > >     http://xircles.codehaus.org/manage_email
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > > >
> > > >  > >  > >
> > > >  > >  > >
> > > >  >
> > ---------------------------------------------------------------------
> > > >  > >  > > To unsubscribe from this list, please visit:
> > > >  > >  > >
> > > >  > >  > >     http://xircles.codehaus.org/manage_email
> > > >  > >  > >
> > > >  > >  >
> > > >  > >  >
> > > ---------------------------------------------------------------------
> > > >  > >  > To unsubscribe from this list, please visit:
> > > >  > >  >
> > > >  > >  >     http://xircles.codehaus.org/manage_email
> > > >  > >  >
> > > >  > >
> > > >  > >
> > > ---------------------------------------------------------------------
> > > >  > >  To unsubscribe from this list, please visit:
> > > >  > >
> > > >  > >     http://xircles.codehaus.org/manage_email
> > > >  > >
> > > >  > >
> > > >  > >
> > > >  >
> > > >  >
> > ---------------------------------------------------------------------
> > > >  > To unsubscribe from this list, please visit:
> > > >  >
> > > >  >     http://xircles.codehaus.org/manage_email
> > > >  >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > >  To unsubscribe from this list, please visit:
> > > >
> > > >     http://xircles.codehaus.org/manage_email
> > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe from this list, please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
> >
> >

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


< Prev | 1 - 2 | Next >