[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-4388) Components at ScopeType.CONVERSATION cause JBoss (4 & 5) to fail loading session state

Christian Bauer (JIRA) jira-events at lists.jboss.org
Wed Aug 26 18:39:23 EDT 2009

    [ https://jira.jboss.org/jira/browse/JBSEAM-4388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12482917#action_12482917 ] 

Christian Bauer commented on JBSEAM-4388:

So the problem is the following:

A Seam JavaBean component in the HTTP session (SESSION or CONVERSATION scoped) gets serialized to be stored in a file as the HTTP session is serialized.

When the serialized state is read during redeploy, which is the first thing that happens after a restart, Tomcat calls the HttpSessionActivationListener methods that have been transparently applied to any Seam JavaBean component by the Seam proxy factory. 

This fails because no Seam context is active at that time, Seam will be started right after the reactivation of the session state by a servlet listener, which is too late for any method call on the deserialized component.

It works for the Credentials and Identity components because they are annotated with @BypassInterceptor, which means that no Seam context is required when a method is called (including the proxy-added methods of HttpSessionActivationListener).  So they can be stored in a file and restored before Seam starts just fine. Any component that does not disable the Seam interceptors can't.

My issue is that I can't even reproduce your CNFE because I'm already getting a "no context is active" exception when my SESSION scoped bean without @BypassInterceptors is being deserialized before Seam starts again (sessionDidActivate() is one of the listener methods added by the proxy to the Javabean):

[ScannerThread] 00:29:22,437 INFO  [org.jboss.web.tomcat.service.TomcatDeployer] deploy, ctxPath=/skeleton, warUrl=.../deploy/skeleton.war/
[ScannerThread] 00:29:22,649 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/skeleton]] Session attribute event listener threw exception
java.lang.IllegalStateException: Attempted to invoke a Seam component outside an initialized application
        at org.jboss.seam.contexts.Lifecycle.getApplication(Lifecycle.java:36)
        at org.jboss.seam.contexts.Lifecycle.setupApplication(Lifecycle.java:134)
        at org.jboss.seam.Seam.componentForName(Seam.java:301)
        at org.jboss.seam.intercept.RootInterceptor.getComponent(RootInterceptor.java:226)
        at org.jboss.seam.intercept.JavaBeanInterceptor.callPostActivate(JavaBeanInterceptor.java:164)
        at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:73)
        at my.skeleton.example.model.Test_$$_javassist_seam_0.sessionDidActivate(Test_$$_javassist_seam_0.java)

That's why I'd say this has never been supported at all because I can't see how it would ever work with the current code. 

You need to show me how to get past that exception and to get the CNFE, preferably by attaching/explaining your code and what component in what deployment environment exactly is throwing that exception.

> Components at ScopeType.CONVERSATION cause JBoss (4 & 5) to fail loading session state
> --------------------------------------------------------------------------------------
>                 Key: JBSEAM-4388
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4388
>             Project: Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.2.0.GA
>         Environment: JBoss 4.2.3 or JBoss 5.1, jboss-seam-2.2.0, JBoss set up to hot deploy.
>            Reporter: David Thompson
>            Assignee: Christian Bauer
>            Priority: Minor
> We currently write struts apps. One of the things we do is hot deploy these apps by setting up JBoss/Tomcat (jboss-web.deployer) to enable session persistence. This way when an app is deployed with "ant deploy", the session data can be stored out--app is torn down-- then when new app deploys the session data restores.
> If a component that is in ScopeType.CONVERSATION is instantiated and is currently in the Conversation Context when the app is deployed, then JBoss throws an error trying to reload the component and no SESSION data is restored. For example, all logged in users (data stored in Identity or Credentials) do not restore so all users get the boot. This doesn't happen if the scope on a component is EVENT or SESSION. For the way we deploy to our production system, this causes problems for us.
> The ideal solution, would be to have the conversations to come back to life, but we could also live with the conversations not being reestablished--but we really need the other session data (such as login credentials) to live through the deploy.
> AFAIK, I have looked all over the web and read the seam reference as well as Seam In Action and can't find any information about how Conversations can persist over a session (such as a redeploy this way) or over a cluster.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list