You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aadi Deshpande <ma...@clubmom-inc.com> on 2004/02/26 04:45:44 UTC

Cluster error when starting up web application

Hi,

I just got Tomcat 5.0.19 and after setting up the new delta based 
cluster manager, i get this during the startup my application :

SEVERE: Session event listener threw exception
java.lang.IllegalStateException: setAttribute: Session already invalidated
        at 
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.java:1306)
        at 
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.java:1283)
        at 
org.apache.catalina.cluster.session.DeltaSessionFacade.setAttribute(DeltaSessionFacade.java:17
7)
        at 
com.opensymphony.webwork.lifecycle.SessionLifecycleListener.sessionCreated(SessionLifecycleLis
tener.java:50)
        at 
org.apache.catalina.cluster.session.DeltaSession.tellNew(DeltaSession.java:459)
        at 
org.apache.catalina.cluster.session.DeltaSession.setId(DeltaSession.java:431)
        at 
org.apache.catalina.cluster.session.DeltaManager.createSession(DeltaManager.java:377)
        at 
org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManager.java:895)
        at 
org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaManager.java:794)
        at 
org.apache.catalina.cluster.tcp.SimpleTcpCluster.messageDataReceived(SimpleTcpCluster.java:561
)
        at 
org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:117)
        at 
org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplicationThread.java:17
6)
        at 
org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThread.java:114)



As far as I can tell, it's happening when I request a page that has the 
webwork2 RequestLifecycleFilter set for that url pattern.  The doFilter 
function creates a HttpSession if none exists, which I assume calls the 
SessionLifecycleListener.sessionCreated(), but for some reason, it seems 
like the session is being invalidated prematurely..


Here's the relevant piece from my web.xml :
    <filter>
        <filter-name>container</filter-name>
        <filter-class>
            
com.opensymphony.webwork.lifecycle.RequestLifecycleFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>container</filter-name>
        <url-pattern>/*</url-pattern>
        <!-- modify appropriately -->
    </filter-mapping>
    <listener>
        <listener-class>
            
com.opensymphony.webwork.lifecycle.SessionLifecycleListener</listener-class>
    </listener>
    <listener>
        <listener-class>
            
com.opensymphony.webwork.lifecycle.ApplicationLifecycleListener</listener-class>
    </listener>

and from my server.xml file, taken pretty much verbatim from the default 
server.xml:

    <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
                 
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
                 expireSessionsOnShutdown="false"
                 useDirtyFlag="true">

            <Membership
                className="org.apache.catalina.cluster.mcast.McastService"
                mcastAddr="224.64.64.128"
                mcastPort="45600"
                mcastFrequency="500"
                mcastDropTime="3000"/>

     <Receiver
                
className="org.apache.catalina.cluster.tcp.ReplicationListener"
                tcpListenAddress="auto"
                tcpListenPort="4060"
                tcpSelectorTimeout="100"
                tcpThreadCount="3"/>

            <Sender
                
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
                replicationMode="pooled"/>


         <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
               filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>

        </Cluster>

Anyone know what's going on? Or can provide some insight into what I may 
be missing?

Thanks for any info.

-a


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Cluster error when starting up web application

Posted by Aadi Deshpande <ma...@clubmom-inc.com>.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27296

Thank you for making excellent software.

p.s.  i'd also like to just say thanks to person(s) reponsible for the 
main build.xml file which made getting and building tomcat such a breeze.


Filip Hanik (lists) wrote:

>thanks for the very diligent email,
>open a bug, and I will address this issue shortly.
>
>thank you for helping us make better software
>
>Filip
>
>-----Original Message-----
>From: Aadi Deshpande [mailto:mailinglists@clubmom-inc.com]
>Sent: Wednesday, February 25, 2004 10:36 PM
>To: Tomcat Users List
>Subject: Re: Cluster error when starting up web application
>
>
>Upon further research, it seems that DeltaSession.setId() fires the
>sessionCreated events to registered listeners, but this happens before a
>session is declared valid ( i.e. setValid(true) has not been called ).
>
>so when a  registered listener tries to utilize ( what it seems to
>believe is ) a newly created session, the setAttribute method throws the
>IllegalStateException..
>
>Now I don't know too much about how the actual workings of the
>HttpSession should go, but in my opinion, the sessionCreated events
>should not be fired unless a valid session has been created.  which
>seems to imply that maybe setValid() should doing the firing...
>
>However, that doesn't sit well with me since it doesn't make sense for a
>session to be truly valid unless it has a sessionId, which either
>forces there to be an implict order between setId() and setValid() which
>is no good, requiring that either/or check to see if the other has been
>truly satisfied, and setting up some sort of implicit sequence coupling.
>
>the alternative, as I see it, is move the tellNew() invocation to the
>DeltaManager ( it's declared public, so it's already exposed ).
>
>I tried that, by patching up the TC5 sources and it seemed to resolve
>the issue.
>
>Again, as I know little to nothing of how sessions should work and what
>other implications this refactoring may have, what should be my next
>course of action?
>
>Should I contact the webwork people? Is this not correct use of sessions
>and session listeners?
>
>Should I open up a bug and/or propose my patch?
>
>Thanks in advance for reading and/or responding,
>
>-a
>
>
>
>
>
>Aadi Deshpande wrote:
>
>  
>
>>Hi,
>>
>>I just got Tomcat 5.0.19 and after setting up the new delta based
>>cluster manager, i get this during the startup my application :
>>
>>SEVERE: Session event listener threw exception
>>java.lang.IllegalStateException: setAttribute: Session already
>>invalidated
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
>ava:1306)
>  
>
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
>ava:1283)
>  
>
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.session.DeltaSessionFacade.setAttribute(DeltaSes
>sionFacade.java:17
>  
>
>>7)
>>       at
>>
>>    
>>
>com.opensymphony.webwork.lifecycle.SessionLifecycleListener.sessionCreated(S
>essionLifecycleLis
>  
>
>>tener.java:50)
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.session.DeltaSession.tellNew(DeltaSession.java:4
>59)
>  
>
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.session.DeltaSession.setId(DeltaSession.java:431
>)
>  
>
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.session.DeltaManager.createSession(DeltaManager.
>java:377)
>  
>
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManage
>r.java:895)
>  
>
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaMa
>nager.java:794)
>  
>
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.tcp.SimpleTcpCluster.messageDataReceived(SimpleT
>cpCluster.java:561
>  
>
>>)
>>       at
>>org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:117)
>>
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplica
>tionThread.java:17
>  
>
>>6)
>>       at
>>
>>    
>>
>org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThrea
>d.java:114)
>  
>
>>
>>
>>As far as I can tell, it's happening when I request a page that has
>>the webwork2 RequestLifecycleFilter set for that url pattern.  The
>>doFilter function creates a HttpSession if none exists, which I assume
>>calls the SessionLifecycleListener.sessionCreated(), but for some
>>reason, it seems like the session is being invalidated prematurely..
>>
>>
>>Here's the relevant piece from my web.xml :
>>   <filter>
>>       <filter-name>container</filter-name>
>>       <filter-class>
>>
>>com.opensymphony.webwork.lifecycle.RequestLifecycleFilter</filter-class>
>>   </filter>
>>   <filter-mapping>
>>       <filter-name>container</filter-name>
>>       <url-pattern>/*</url-pattern>
>>       <!-- modify appropriately -->
>>   </filter-mapping>
>>   <listener>
>>       <listener-class>
>>
>>
>>    
>>
>com.opensymphony.webwork.lifecycle.SessionLifecycleListener</listener-class>
>  
>
>>   </listener>
>>   <listener>
>>       <listener-class>
>>
>>
>>    
>>
>com.opensymphony.webwork.lifecycle.ApplicationLifecycleListener</listener-cl
>ass>
>  
>
>>   </listener>
>>
>>and from my server.xml file, taken pretty much verbatim from the
>>default server.xml:
>>
>>   <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>>
>>managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>>                expireSessionsOnShutdown="false"
>>                useDirtyFlag="true">
>>
>>           <Membership
>>               className="org.apache.catalina.cluster.mcast.McastService"
>>               mcastAddr="224.64.64.128"
>>               mcastPort="45600"
>>               mcastFrequency="500"
>>               mcastDropTime="3000"/>
>>
>>    <Receiver
>>
>>className="org.apache.catalina.cluster.tcp.ReplicationListener"
>>               tcpListenAddress="auto"
>>               tcpListenPort="4060"
>>               tcpSelectorTimeout="100"
>>               tcpThreadCount="3"/>
>>
>>           <Sender
>>
>>className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>>               replicationMode="pooled"/>
>>
>>
>>        <Valve
>>className="org.apache.catalina.cluster.tcp.ReplicationValve"
>>              filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
>>
>>       </Cluster>
>>
>>Anyone know what's going on? Or can provide some insight into what I
>>may be missing?
>>
>>Thanks for any info.
>>
>>-a
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>    
>>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Cluster error when starting up web application

Posted by "Filip Hanik (lists)" <de...@hanik.com>.
thanks for the very diligent email,
open a bug, and I will address this issue shortly.

thank you for helping us make better software

Filip

-----Original Message-----
From: Aadi Deshpande [mailto:mailinglists@clubmom-inc.com]
Sent: Wednesday, February 25, 2004 10:36 PM
To: Tomcat Users List
Subject: Re: Cluster error when starting up web application


Upon further research, it seems that DeltaSession.setId() fires the
sessionCreated events to registered listeners, but this happens before a
session is declared valid ( i.e. setValid(true) has not been called ).

so when a  registered listener tries to utilize ( what it seems to
believe is ) a newly created session, the setAttribute method throws the
IllegalStateException..

Now I don't know too much about how the actual workings of the
HttpSession should go, but in my opinion, the sessionCreated events
should not be fired unless a valid session has been created.  which
seems to imply that maybe setValid() should doing the firing...

However, that doesn't sit well with me since it doesn't make sense for a
session to be truly valid unless it has a sessionId, which either
forces there to be an implict order between setId() and setValid() which
is no good, requiring that either/or check to see if the other has been
truly satisfied, and setting up some sort of implicit sequence coupling.

the alternative, as I see it, is move the tellNew() invocation to the
DeltaManager ( it's declared public, so it's already exposed ).

I tried that, by patching up the TC5 sources and it seemed to resolve
the issue.

Again, as I know little to nothing of how sessions should work and what
other implications this refactoring may have, what should be my next
course of action?

Should I contact the webwork people? Is this not correct use of sessions
and session listeners?

Should I open up a bug and/or propose my patch?

Thanks in advance for reading and/or responding,

-a





Aadi Deshpande wrote:

> Hi,
>
> I just got Tomcat 5.0.19 and after setting up the new delta based
> cluster manager, i get this during the startup my application :
>
> SEVERE: Session event listener threw exception
> java.lang.IllegalStateException: setAttribute: Session already
> invalidated
>        at
>
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
ava:1306)
>
>        at
>
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
ava:1283)
>
>        at
>
org.apache.catalina.cluster.session.DeltaSessionFacade.setAttribute(DeltaSes
sionFacade.java:17
>
> 7)
>        at
>
com.opensymphony.webwork.lifecycle.SessionLifecycleListener.sessionCreated(S
essionLifecycleLis
>
> tener.java:50)
>        at
>
org.apache.catalina.cluster.session.DeltaSession.tellNew(DeltaSession.java:4
59)
>
>        at
>
org.apache.catalina.cluster.session.DeltaSession.setId(DeltaSession.java:431
)
>
>        at
>
org.apache.catalina.cluster.session.DeltaManager.createSession(DeltaManager.
java:377)
>
>        at
>
org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManage
r.java:895)
>
>        at
>
org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaMa
nager.java:794)
>
>        at
>
org.apache.catalina.cluster.tcp.SimpleTcpCluster.messageDataReceived(SimpleT
cpCluster.java:561
>
> )
>        at
> org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:117)
>
>        at
>
org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplica
tionThread.java:17
>
> 6)
>        at
>
org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThrea
d.java:114)
>
>
>
>
> As far as I can tell, it's happening when I request a page that has
> the webwork2 RequestLifecycleFilter set for that url pattern.  The
> doFilter function creates a HttpSession if none exists, which I assume
> calls the SessionLifecycleListener.sessionCreated(), but for some
> reason, it seems like the session is being invalidated prematurely..
>
>
> Here's the relevant piece from my web.xml :
>    <filter>
>        <filter-name>container</filter-name>
>        <filter-class>
>
> com.opensymphony.webwork.lifecycle.RequestLifecycleFilter</filter-class>
>    </filter>
>    <filter-mapping>
>        <filter-name>container</filter-name>
>        <url-pattern>/*</url-pattern>
>        <!-- modify appropriately -->
>    </filter-mapping>
>    <listener>
>        <listener-class>
>
>
com.opensymphony.webwork.lifecycle.SessionLifecycleListener</listener-class>
>
>    </listener>
>    <listener>
>        <listener-class>
>
>
com.opensymphony.webwork.lifecycle.ApplicationLifecycleListener</listener-cl
ass>
>
>    </listener>
>
> and from my server.xml file, taken pretty much verbatim from the
> default server.xml:
>
>    <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>
> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>                 expireSessionsOnShutdown="false"
>                 useDirtyFlag="true">
>
>            <Membership
>                className="org.apache.catalina.cluster.mcast.McastService"
>                mcastAddr="224.64.64.128"
>                mcastPort="45600"
>                mcastFrequency="500"
>                mcastDropTime="3000"/>
>
>     <Receiver
>
> className="org.apache.catalina.cluster.tcp.ReplicationListener"
>                tcpListenAddress="auto"
>                tcpListenPort="4060"
>                tcpSelectorTimeout="100"
>                tcpThreadCount="3"/>
>
>            <Sender
>
> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>                replicationMode="pooled"/>
>
>
>         <Valve
> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>               filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
>
>        </Cluster>
>
> Anyone know what's going on? Or can provide some insight into what I
> may be missing?
>
> Thanks for any info.
>
> -a
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Cluster error when starting up web application

Posted by "Filip Hanik (lists)" <de...@hanik.com>.
now remember, that I actually don't have to invoke the listeners upon
replication, I am doing it anyway, cause I think it might help, but there is
a risk in some apps that it may not.
the spec is in the gray, it doesn't say that you have to or not.

Filip

-----Original Message-----
From: Filip Hanik (lists) [mailto:devlists@hanik.com]
Sent: Monday, March 01, 2004 1:40 PM
To: Tomcat Users List
Subject: RE: Cluster error when starting up web application


I just committed a fix into CVS,
I didn't change the tellNew, instead I moved setValid(true) before I called
tellNew() during session
creation.

Filip

-----Original Message-----
From: Aadi Deshpande [mailto:mailinglists@clubmom-inc.com]
Sent: Wednesday, February 25, 2004 10:36 PM
To: Tomcat Users List
Subject: Re: Cluster error when starting up web application


Upon further research, it seems that DeltaSession.setId() fires the
sessionCreated events to registered listeners, but this happens before a
session is declared valid ( i.e. setValid(true) has not been called ).

so when a  registered listener tries to utilize ( what it seems to
believe is ) a newly created session, the setAttribute method throws the
IllegalStateException..

Now I don't know too much about how the actual workings of the
HttpSession should go, but in my opinion, the sessionCreated events
should not be fired unless a valid session has been created.  which
seems to imply that maybe setValid() should doing the firing...

However, that doesn't sit well with me since it doesn't make sense for a
session to be truly valid unless it has a sessionId, which either
forces there to be an implict order between setId() and setValid() which
is no good, requiring that either/or check to see if the other has been
truly satisfied, and setting up some sort of implicit sequence coupling.

the alternative, as I see it, is move the tellNew() invocation to the
DeltaManager ( it's declared public, so it's already exposed ).

I tried that, by patching up the TC5 sources and it seemed to resolve
the issue.

Again, as I know little to nothing of how sessions should work and what
other implications this refactoring may have, what should be my next
course of action?

Should I contact the webwork people? Is this not correct use of sessions
and session listeners?

Should I open up a bug and/or propose my patch?

Thanks in advance for reading and/or responding,

-a





Aadi Deshpande wrote:

> Hi,
>
> I just got Tomcat 5.0.19 and after setting up the new delta based
> cluster manager, i get this during the startup my application :
>
> SEVERE: Session event listener threw exception
> java.lang.IllegalStateException: setAttribute: Session already
> invalidated
>        at
>
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
ava:1306)
>
>        at
>
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
ava:1283)
>
>        at
>
org.apache.catalina.cluster.session.DeltaSessionFacade.setAttribute(DeltaSes
sionFacade.java:17
>
> 7)
>        at
>
com.opensymphony.webwork.lifecycle.SessionLifecycleListener.sessionCreated(S
essionLifecycleLis
>
> tener.java:50)
>        at
>
org.apache.catalina.cluster.session.DeltaSession.tellNew(DeltaSession.java:4
59)
>
>        at
>
org.apache.catalina.cluster.session.DeltaSession.setId(DeltaSession.java:431
)
>
>        at
>
org.apache.catalina.cluster.session.DeltaManager.createSession(DeltaManager.
java:377)
>
>        at
>
org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManage
r.java:895)
>
>        at
>
org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaMa
nager.java:794)
>
>        at
>
org.apache.catalina.cluster.tcp.SimpleTcpCluster.messageDataReceived(SimpleT
cpCluster.java:561
>
> )
>        at
> org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:117)
>
>        at
>
org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplica
tionThread.java:17
>
> 6)
>        at
>
org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThrea
d.java:114)
>
>
>
>
> As far as I can tell, it's happening when I request a page that has
> the webwork2 RequestLifecycleFilter set for that url pattern.  The
> doFilter function creates a HttpSession if none exists, which I assume
> calls the SessionLifecycleListener.sessionCreated(), but for some
> reason, it seems like the session is being invalidated prematurely..
>
>
> Here's the relevant piece from my web.xml :
>    <filter>
>        <filter-name>container</filter-name>
>        <filter-class>
>
> com.opensymphony.webwork.lifecycle.RequestLifecycleFilter</filter-class>
>    </filter>
>    <filter-mapping>
>        <filter-name>container</filter-name>
>        <url-pattern>/*</url-pattern>
>        <!-- modify appropriately -->
>    </filter-mapping>
>    <listener>
>        <listener-class>
>
>
com.opensymphony.webwork.lifecycle.SessionLifecycleListener</listener-class>
>
>    </listener>
>    <listener>
>        <listener-class>
>
>
com.opensymphony.webwork.lifecycle.ApplicationLifecycleListener</listener-cl
ass>
>
>    </listener>
>
> and from my server.xml file, taken pretty much verbatim from the
> default server.xml:
>
>    <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>
> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>                 expireSessionsOnShutdown="false"
>                 useDirtyFlag="true">
>
>            <Membership
>                className="org.apache.catalina.cluster.mcast.McastService"
>                mcastAddr="224.64.64.128"
>                mcastPort="45600"
>                mcastFrequency="500"
>                mcastDropTime="3000"/>
>
>     <Receiver
>
> className="org.apache.catalina.cluster.tcp.ReplicationListener"
>                tcpListenAddress="auto"
>                tcpListenPort="4060"
>                tcpSelectorTimeout="100"
>                tcpThreadCount="3"/>
>
>            <Sender
>
> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>                replicationMode="pooled"/>
>
>
>         <Valve
> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>               filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
>
>        </Cluster>
>
> Anyone know what's going on? Or can provide some insight into what I
> may be missing?
>
> Thanks for any info.
>
> -a
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Cluster error when starting up web application

Posted by "Filip Hanik (lists)" <de...@hanik.com>.
I just committed a fix into CVS,
I didn't change the tellNew, instead I moved setValid(true) before I called
tellNew() during session
creation.

Filip

-----Original Message-----
From: Aadi Deshpande [mailto:mailinglists@clubmom-inc.com]
Sent: Wednesday, February 25, 2004 10:36 PM
To: Tomcat Users List
Subject: Re: Cluster error when starting up web application


Upon further research, it seems that DeltaSession.setId() fires the
sessionCreated events to registered listeners, but this happens before a
session is declared valid ( i.e. setValid(true) has not been called ).

so when a  registered listener tries to utilize ( what it seems to
believe is ) a newly created session, the setAttribute method throws the
IllegalStateException..

Now I don't know too much about how the actual workings of the
HttpSession should go, but in my opinion, the sessionCreated events
should not be fired unless a valid session has been created.  which
seems to imply that maybe setValid() should doing the firing...

However, that doesn't sit well with me since it doesn't make sense for a
session to be truly valid unless it has a sessionId, which either
forces there to be an implict order between setId() and setValid() which
is no good, requiring that either/or check to see if the other has been
truly satisfied, and setting up some sort of implicit sequence coupling.

the alternative, as I see it, is move the tellNew() invocation to the
DeltaManager ( it's declared public, so it's already exposed ).

I tried that, by patching up the TC5 sources and it seemed to resolve
the issue.

Again, as I know little to nothing of how sessions should work and what
other implications this refactoring may have, what should be my next
course of action?

Should I contact the webwork people? Is this not correct use of sessions
and session listeners?

Should I open up a bug and/or propose my patch?

Thanks in advance for reading and/or responding,

-a





Aadi Deshpande wrote:

> Hi,
>
> I just got Tomcat 5.0.19 and after setting up the new delta based
> cluster manager, i get this during the startup my application :
>
> SEVERE: Session event listener threw exception
> java.lang.IllegalStateException: setAttribute: Session already
> invalidated
>        at
>
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
ava:1306)
>
>        at
>
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
ava:1283)
>
>        at
>
org.apache.catalina.cluster.session.DeltaSessionFacade.setAttribute(DeltaSes
sionFacade.java:17
>
> 7)
>        at
>
com.opensymphony.webwork.lifecycle.SessionLifecycleListener.sessionCreated(S
essionLifecycleLis
>
> tener.java:50)
>        at
>
org.apache.catalina.cluster.session.DeltaSession.tellNew(DeltaSession.java:4
59)
>
>        at
>
org.apache.catalina.cluster.session.DeltaSession.setId(DeltaSession.java:431
)
>
>        at
>
org.apache.catalina.cluster.session.DeltaManager.createSession(DeltaManager.
java:377)
>
>        at
>
org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManage
r.java:895)
>
>        at
>
org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaMa
nager.java:794)
>
>        at
>
org.apache.catalina.cluster.tcp.SimpleTcpCluster.messageDataReceived(SimpleT
cpCluster.java:561
>
> )
>        at
> org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:117)
>
>        at
>
org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplica
tionThread.java:17
>
> 6)
>        at
>
org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThrea
d.java:114)
>
>
>
>
> As far as I can tell, it's happening when I request a page that has
> the webwork2 RequestLifecycleFilter set for that url pattern.  The
> doFilter function creates a HttpSession if none exists, which I assume
> calls the SessionLifecycleListener.sessionCreated(), but for some
> reason, it seems like the session is being invalidated prematurely..
>
>
> Here's the relevant piece from my web.xml :
>    <filter>
>        <filter-name>container</filter-name>
>        <filter-class>
>
> com.opensymphony.webwork.lifecycle.RequestLifecycleFilter</filter-class>
>    </filter>
>    <filter-mapping>
>        <filter-name>container</filter-name>
>        <url-pattern>/*</url-pattern>
>        <!-- modify appropriately -->
>    </filter-mapping>
>    <listener>
>        <listener-class>
>
>
com.opensymphony.webwork.lifecycle.SessionLifecycleListener</listener-class>
>
>    </listener>
>    <listener>
>        <listener-class>
>
>
com.opensymphony.webwork.lifecycle.ApplicationLifecycleListener</listener-cl
ass>
>
>    </listener>
>
> and from my server.xml file, taken pretty much verbatim from the
> default server.xml:
>
>    <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>
> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>                 expireSessionsOnShutdown="false"
>                 useDirtyFlag="true">
>
>            <Membership
>                className="org.apache.catalina.cluster.mcast.McastService"
>                mcastAddr="224.64.64.128"
>                mcastPort="45600"
>                mcastFrequency="500"
>                mcastDropTime="3000"/>
>
>     <Receiver
>
> className="org.apache.catalina.cluster.tcp.ReplicationListener"
>                tcpListenAddress="auto"
>                tcpListenPort="4060"
>                tcpSelectorTimeout="100"
>                tcpThreadCount="3"/>
>
>            <Sender
>
> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>                replicationMode="pooled"/>
>
>
>         <Valve
> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>               filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
>
>        </Cluster>
>
> Anyone know what's going on? Or can provide some insight into what I
> may be missing?
>
> Thanks for any info.
>
> -a
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Cluster error when starting up web application

Posted by Aadi Deshpande <ma...@clubmom-inc.com>.
Upon further research, it seems that DeltaSession.setId() fires the 
sessionCreated events to registered listeners, but this happens before a 
session is declared valid ( i.e. setValid(true) has not been called ).

so when a  registered listener tries to utilize ( what it seems to 
believe is ) a newly created session, the setAttribute method throws the 
IllegalStateException..

Now I don't know too much about how the actual workings of the 
HttpSession should go, but in my opinion, the sessionCreated events 
should not be fired unless a valid session has been created.  which 
seems to imply that maybe setValid() should doing the firing...

However, that doesn't sit well with me since it doesn't make sense for a 
session to be truly valid unless it has a sessionId, which either
forces there to be an implict order between setId() and setValid() which 
is no good, requiring that either/or check to see if the other has been 
truly satisfied, and setting up some sort of implicit sequence coupling.

the alternative, as I see it, is move the tellNew() invocation to the 
DeltaManager ( it's declared public, so it's already exposed ).

I tried that, by patching up the TC5 sources and it seemed to resolve 
the issue.

Again, as I know little to nothing of how sessions should work and what 
other implications this refactoring may have, what should be my next 
course of action?

Should I contact the webwork people? Is this not correct use of sessions 
and session listeners?

Should I open up a bug and/or propose my patch?

Thanks in advance for reading and/or responding,

-a





Aadi Deshpande wrote:

> Hi,
>
> I just got Tomcat 5.0.19 and after setting up the new delta based 
> cluster manager, i get this during the startup my application :
>
> SEVERE: Session event listener threw exception
> java.lang.IllegalStateException: setAttribute: Session already 
> invalidated
>        at 
> org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.java:1306) 
>
>        at 
> org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.java:1283) 
>
>        at 
> org.apache.catalina.cluster.session.DeltaSessionFacade.setAttribute(DeltaSessionFacade.java:17 
>
> 7)
>        at 
> com.opensymphony.webwork.lifecycle.SessionLifecycleListener.sessionCreated(SessionLifecycleLis 
>
> tener.java:50)
>        at 
> org.apache.catalina.cluster.session.DeltaSession.tellNew(DeltaSession.java:459) 
>
>        at 
> org.apache.catalina.cluster.session.DeltaSession.setId(DeltaSession.java:431) 
>
>        at 
> org.apache.catalina.cluster.session.DeltaManager.createSession(DeltaManager.java:377) 
>
>        at 
> org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManager.java:895) 
>
>        at 
> org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaManager.java:794) 
>
>        at 
> org.apache.catalina.cluster.tcp.SimpleTcpCluster.messageDataReceived(SimpleTcpCluster.java:561 
>
> )
>        at 
> org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:117) 
>
>        at 
> org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplicationThread.java:17 
>
> 6)
>        at 
> org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThread.java:114) 
>
>
>
>
> As far as I can tell, it's happening when I request a page that has 
> the webwork2 RequestLifecycleFilter set for that url pattern.  The 
> doFilter function creates a HttpSession if none exists, which I assume 
> calls the SessionLifecycleListener.sessionCreated(), but for some 
> reason, it seems like the session is being invalidated prematurely..
>
>
> Here's the relevant piece from my web.xml :
>    <filter>
>        <filter-name>container</filter-name>
>        <filter-class>
>            
> com.opensymphony.webwork.lifecycle.RequestLifecycleFilter</filter-class>
>    </filter>
>    <filter-mapping>
>        <filter-name>container</filter-name>
>        <url-pattern>/*</url-pattern>
>        <!-- modify appropriately -->
>    </filter-mapping>
>    <listener>
>        <listener-class>
>            
> com.opensymphony.webwork.lifecycle.SessionLifecycleListener</listener-class> 
>
>    </listener>
>    <listener>
>        <listener-class>
>            
> com.opensymphony.webwork.lifecycle.ApplicationLifecycleListener</listener-class> 
>
>    </listener>
>
> and from my server.xml file, taken pretty much verbatim from the 
> default server.xml:
>
>    <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>                 
> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>                 expireSessionsOnShutdown="false"
>                 useDirtyFlag="true">
>
>            <Membership
>                className="org.apache.catalina.cluster.mcast.McastService"
>                mcastAddr="224.64.64.128"
>                mcastPort="45600"
>                mcastFrequency="500"
>                mcastDropTime="3000"/>
>
>     <Receiver
>                
> className="org.apache.catalina.cluster.tcp.ReplicationListener"
>                tcpListenAddress="auto"
>                tcpListenPort="4060"
>                tcpSelectorTimeout="100"
>                tcpThreadCount="3"/>
>
>            <Sender
>                
> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>                replicationMode="pooled"/>
>
>
>         <Valve 
> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>               filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
>
>        </Cluster>
>
> Anyone know what's going on? Or can provide some insight into what I 
> may be missing?
>
> Thanks for any info.
>
> -a
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org