Spring 3 MVC, Tomcat -Webap hangs after a few requests

i created (my first) small spring 3 MVC application, but ran into an issue which is a little bit mysterious for me.

The application has a few forms to manipulate a database. I created one Controller Java class which maps all requests to java Methods (see code). After a few requests in the browser the webapp crashes. The code for manipulating a database entry is called successfully but the reload of the page seem to fail.

Controller class:

@RequestMapping("/usermanager") public String getUserInfo(Map<String, Object> map) throws ServletException { try { map.put("userInfo", userService.getUserInfo()); } catch (Exception e) { throw new ServletException(e); } return "usermanager"; } @RequestMapping("/updateUserInfo") public String updateUserInfo(@ModelAttribute("userInfo") User user) throws NamingException, SQLException { userService.storeUserInfo(user); return "redirect:/service/usermanager"; }

The structure is really easy, the request usermanager is called to show the table data. The site shows a form where i can edit my data, submitting the form calls the updateUserInfo request. After a few times the request hangs at return "usermanager";.

Did someone have an explanation for this behavior. Or an idea?

Edit: BTW: There are no Exceptions or something else. The webapp simply hangs.

Many thanks, Regards Sascha

-------------Problems Reply------------

i found the bug. Looked at the wrong place.

The error occurs indeed in the getUserInfo(). But it is a more general problem with my database connection method.

Everytime a do a database query, i called: connection = dataSource.getConnection(); That causes the leak. It is better to check if there is already a connection :-D

if (connection == null || connection.isClosed()) {
connection = dataSource.getConnection();

BTW I use an embedded Derby Database which is accessed by the jdbcTemplate.

Sometimes we do not see the wood for the trees :-)

Thanks for your effort. Have a nice day Sascha

Category:java Views:0 Time:2011-07-28

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.095 (s). 11 q(s)