Re: Exception in hibernate3
I struggled with this issue for a long period, at the end I reached a good point: I started using database connection pools [1]. Actually you should wait until the mysql connection dies (it should be after 8 hours of db inactivity ), but you could change the connect-timeout=seconds [2] in order to achieve the before mentioned scenario. [1] http://commons.apache.org/dbcp/ [2] http://dev.mysql.com/doc/refman/5.5/en/mysql-options.html Here my context.xml is: Context override=true reloadable=false unpackWARs=true autoDeploy=true liveDeploy=false allowLinking=true !-- maxActive=10 Don't set this any higher than max_connections on your MySQL server, usually this should be a 10 or a few 10's of connections, not hundreds or thousands -- !-- maxIdle=5 You don't want to many idle connections hanging around if you can avoid it, only enough to soak up a spike in the load -- !-- validationQuery=select 1 Don't use autoReconnect=true, it's going away eventually and it's a crutch for older connection pools that couldn't test connections. You need to decide whether your application is supposed to deal with SQLExceptions (hint, it should), and how much of a performance penalty you're willing to pay to ensure 'freshness' of the connection -- !-- testOnBorrow=true The most conservative approach is to test connections before they're given to your application. For most applications this is okay, the query used above is very small and takes no real server resources to process, other than the time used to traverse the network. If you have a high-load application you'll need to rely on something else. -- !-- testWhileIdle=true Otherwise, or in addition to testOnBorrow, you can test while connections are sitting idle -- !-- timeBetweenEvictionRunsMillis=1 You have to set this value, otherwise even though you've asked connections to be tested while idle, the idle evicter thread will never run -- !-- minEvictableIdleTimeMillis=6 Don't allow connections to hang out idle too long, never longer than what wait_timeout is set to on the server...A few minutes or even fraction of a minute is sometimes okay here, it depends on your application and how much spikey load it will see -- !-- maxWait Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- !-- removeAbandoned=true A database connection pool creates and manages a pool of connections to a database. Recycling and reusing already existing connections to a dB is more efficient than opening a new connection. There is one problem with connection pooling. A web application has to explicetely close ResultSet's, Statement's, and Connection's. Failure of a web application to close these resources can result in them never being available again for reuse, a db connection pool leak. This can eventually result in your web application db connections failing if there are no more available connections. There is a solution to this problem. The Jakarta-Commons DBCP can be configured to track and recover these abandoned dB connections. Not only can it recover them, but also generate a stack trace for the code which opened these resources and never closed them. -- !-- removeAbandonedTimeout=60 Use the removeAbandonedTimeout attribute to set the number of seconds a dB connection has been idle before it is considered abandoned. -- !-- logAbandoned=true The logAbandoned attribute can be set to true if you want DBCP to log a stack trace of the code which abandoned the dB connection resources. -- Resource type=javax.sql.DataSource name=jdbc/${CONTEXT_NAME} password=PASSWORD driverClassName=org.gjt.mm.mysql.Driver username=${USERNAME} url=jdbc:mysql://localhost/${DB_NAME}?zeroDateTimeBehavior=convertToNull auth=Container factory=org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory maxActive=20 maxIdle=5 validationQuery=select 1 testOnBorrow=true testWhileIdle=true timeBetweenEvictionRunsMillis=1 minEvictableIdleTimeMillis=6 maxWait=5000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true / /Context On 1 March 2011 07:09, abhishek jain
Handling wildcard action names with dot.
I configured struts to handle url mapping with no extensions this way constant name=struts.action.extension value=,, / With this action mapping action name=* class=myAction method=myMethod param name=myId{1}/param result type=tilesmyTile/result /action I can handle urls like: /aaa/bbb/ccc /aaa/bbb/ddd /aaa/bbb/eee But i wish to handle this kind of urls too: /aaa/bbb/fff.xyz /aaa/bbb/fff.jkw /aaa/bbb/fff.anykindofextension But when i insert a DOT in the action name (mapped by a wildcard) I get a 404 error. Any idea? Thank you - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Handling wildcard action names with dot.
I haven't looked at this for some time, but open up DefaultActionMapper and have a look. You can always substitute your own implementation if the outta-the-box is not what you are looking for. Peace, Scott On Tue, Mar 1, 2011 at 7:59 AM, GF gan...@gmail.com wrote: I configured struts to handle url mapping with no extensions this way constant name=struts.action.extension value=,, / With this action mapping action name=* class=myAction method=myMethod param name=myId{1}/param result type=tilesmyTile/result /action I can handle urls like: /aaa/bbb/ccc /aaa/bbb/ddd /aaa/bbb/eee But i wish to handle this kind of urls too: /aaa/bbb/fff.xyz /aaa/bbb/fff.jkw /aaa/bbb/fff.anykindofextension But when i insert a DOT in the action name (mapped by a wildcard) I get a 404 error. Any idea? Thank you - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Handling wildcard action names with dot.
It's possible you might have to play with your filter entries in web.xml also. The container also maps by extension. (*Chris*) On Tue, Mar 1, 2011 at 5:59 AM, GF gan...@gmail.com wrote: I configured struts to handle url mapping with no extensions this way constant name=struts.action.extension value=,, / With this action mapping action name=* class=myAction method=myMethod param name=myId{1}/param result type=tilesmyTile/result /action I can handle urls like: /aaa/bbb/ccc /aaa/bbb/ddd /aaa/bbb/eee But i wish to handle this kind of urls too: /aaa/bbb/fff.xyz /aaa/bbb/fff.jkw /aaa/bbb/fff.anykindofextension But when i insert a DOT in the action name (mapped by a wildcard) I get a 404 error. Any idea? Thank you - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Handling wildcard action names with dot.
I'm afraid that you should consider to use apache mod_rewrite or something like an url rewrite filter [1]? [1] http://www.tuckey.org/urlrewrite/ On 1 March 2011 18:24, Chris Pratt thechrispr...@gmail.com wrote: It's possible you might have to play with your filter entries in web.xml also. The container also maps by extension. (*Chris*) On Tue, Mar 1, 2011 at 5:59 AM, GF gan...@gmail.com wrote: I configured struts to handle url mapping with no extensions this way constant name=struts.action.extension value=,, / With this action mapping action name=* class=myAction method=myMethod param name=myId{1}/param result type=tilesmyTile/result /action I can handle urls like: /aaa/bbb/ccc /aaa/bbb/ddd /aaa/bbb/eee But i wish to handle this kind of urls too: /aaa/bbb/fff.xyz /aaa/bbb/fff.jkw /aaa/bbb/fff.anykindofextension But when i insert a DOT in the action name (mapped by a wildcard) I get a 404 error. Any idea? Thank you - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Handling wildcard action names with dot.
Coincidentally, I've been working on this same issue. I needed struts actions to handle PDFs. My solution was to add pdf to the action extensions, as in: constant name=struts.action.extension value=pdf, / Note the critical trailing comma which allows for blank extensions in addition to pdf. I'm not sure exactly how struts, by default, knows to ignore anything with an extension. Mostly this is a good thing, as it allows you to serve images, static resources, etc., without going through struts. There's this interesting comment in the default.properties file inside the struts core jar: ### The blank extension allows you to match directory listings as well as pure action names ### without interfering with static resources. struts.action.extension=action,, Sounds like what you need is to handle ALL urls, with any possible extension? I don't know how to do that, but I bet there's a way. Of course this would mean that you would have to handle all static resources through struts which could be painful. But maybe you don't have any. Thanks, Fred On 3/1/2011 8:59 AM, GF wrote: I configured struts to handle url mapping with no extensions this way constant name=struts.action.extension value=,, / With this action mapping action name=* class=myAction method=myMethod param name=myId{1}/param result type=tilesmyTile/result /action I can handle urls like: /aaa/bbb/ccc /aaa/bbb/ddd /aaa/bbb/eee But i wish to handle this kind of urls too: /aaa/bbb/fff.xyz /aaa/bbb/fff.jkw /aaa/bbb/fff.anykindofextension But when i insert a DOT in the action name (mapped by a wildcard) I get a 404 error. Any idea? Thank you - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org