Jan 12th, 2007, 03:32 PM
singletons in app container
So we are using struts and jboss with spring.
Our Action contains a PageBuilder, which contains a service, all wired in spring.
the action generates a report. on run 1, the values in the report were fine. One subsequent runs, the values are double the previous value.
This means that the values are persisting in the service between runs, and subsequent runs are adding new data to the old values.
So in our configuration, the pagebuilder and service bean defs were augmented with singleton=false, but the problem is still there....
Does the action need a singleton=false attribute?
Jan 12th, 2007, 04:11 PM
Where is the state held that is causing your report problems?
Jan 12th, 2007, 04:28 PM
the state is held in the service.
Jan 13th, 2007, 04:51 AM
Have you thought about using a <aop:scoped-proxy/>? Basically every request requires a new service, this might be more appropriate.
Have a read.
Jan 17th, 2007, 12:51 PM
thanx for the reference, it seems like it would work. However we are using 1.2.6, and that only seems available in > 2.0.
Any other suggestions? I still don't really understand how this is happening -- if i tell the service to not be a singleton, then it should not persist between requests, unless the Action struts creates for the click is itself reused. Ive been in the struts documentation but see any mention of this....
 -- never mind guys, am dumb, i missed a class that needed to be not-singletoned because I didnt read the struts delegatingactionproxy docs....
Last edited by shrndegruv; Jan 17th, 2007 at 01:22 PM.
Jan 17th, 2007, 02:26 PM
Have you sorted this then?
Jan 17th, 2007, 03:26 PM
yes this problem is solved...
Jan 17th, 2007, 06:53 PM
For what it's worth, it is true that Struts re-uses Actions between requests.
Originally Posted by shrndegruv