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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
