严重: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
翻译后:
严重:Web应用程序[]注册了JDBC驱动程序[com.mysql.jdbc.Driver],但在Web应用程序停止时未能将其注销。为了防止内存泄漏,JDBC驱动程序被强制取消注册。
出错原因:
Spring 容器被重复加载。(这个原因可能仅适用于我的工程)
ItemController.java
@Controller
public class ItemController {
ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
ItemService itemService = (ItemService)ac.getBean("itemServiceImpl");
@RequestMapping(value = "/item/itemlist.action")
public ModelAndView itemList() {
List<Items> itemsList = itemService.selectAllItems();
// 获取视图对象
ModelAndView modelAndView = new ModelAndView();