0

我正在从事以下项目,并遇到了运行时问题。

http://github.com/dmcquillan314/YouthMinistryHibernate

运行该项目的说明位于 README.md 文件中,尽管目前看起来有点混乱。只需查看原始版本,它应该是可读的。完成这些步骤后,您应该可以运行环境。

问题出在管理页面上,该页面位于:

http://localhost:portno/admin

目前正在为所有帐户添加管理员角色以进行测试。

至于重新创建问题的步骤,请参见以下内容:

  1. 注册一个用户帐户,它将自动获得 ROLE_ADMIN 和 ROLE_USER 用户角色。

  2. 导航 /admin 网址

  3. 使用组管理器添加几个组

  4. 尝试添加一个文本条目,它应该冻结我注意到当我设置断点时我没有看到任何流量,这很奇怪..

  5. 如果您无法立即重新创建这种“冻结”,那么请继续尝试创建和更新不同的资产,这似乎是页面内容和事件。现在所有控制器都位于管理控制器类中,直到我将它们移动到不同的控制器。

我已经尝试了几件事来尝试修复它,例如更改我的数据库连接池的会话超时设置以及休眠。

我还尝试设置一些断点以希望看到应用程序冻结的位置,但是它似乎永远不会到达我在发生错误时设置的 AdminController 类中的断点。

日志也有点无用,这是失败实例的最后几行:

16:32:19.061 [tomcat-http--13] DEBUG o.s.security.web.FilterChainProxy - /admin/createtextentry reached end of additional filter chain; proceeding with original chain
    16:32:19.061 [tomcat-http--13] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'appServlet' processing POST request for [/YouthMinistryHibernate/admin/createtextentry]
    16:32:19.061 [tomcat-http--13] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Looking up handler method for path /admin/createtextentry
    16:32:19.062 [tomcat-http--13] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Returning handler method [public java.lang.String com.youthministry.controller.AdminController.handleCreateTextEntry(com.youthministry.domain.TextEntry,org.springframework.validation.BindingResult,org.springframework.ui.Model)]
    16:32:19.062 [tomcat-http--13] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'adminController'
    16:32:19.063 [tomcat-http--13] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'txManager'
    16:32:19.063 [tomcat-http--13] DEBUG o.s.o.h.HibernateTransactionManager - Creating new transaction with name [com.youthministry.service.impl.GroupServiceImpl.getGroupById]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly; ''
    16:32:19.063 [tomcat-http--13] DEBUG o.s.o.h.HibernateTransactionManager - Opened new Session [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[] unresolvedInsertDependencies=UnresolvedEntityInsertActions[]])] for Hibernate transaction
    16:32:19.063 [tomcat-http--13] DEBUG o.s.o.h.HibernateTransactionManager - Preparing JDBC Connection of Hibernate Session [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[] unresolvedInsertDependencies=UnresolvedEntityInsertActions[]])]
    16:32:19.063 [tomcat-http--13] DEBUG o.s.jdbc.datasource.DataSourceUtils - Setting JDBC   Connection [org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler@2dd92714[valid=true]] read-only

到目前为止,我已经了解到,这不是通过我的数据库发生的死锁,而是在尝试访问 Connection ProxyHandler 时在 DataSourceUtils 周围的某个地方出现的死锁,如服务器日志中最后一个长条目所示。

我使用 Spring 3.1、Hibernate 4.1 和 DBCP 作为我的连接池。

非常感谢任何帮助我已经为这个问题苦苦挣扎了一周左右。

4

1 回答 1

0

问题原来是数据库基数问题。

对于集合,我使用的是 OneToMany 而不是应使用 ManyToMany 的 ManyToMany。

至于为什么它被挂起,我不确定。但重要的是它现在已经修复了。

于 2013-07-27T18:07:02.110 回答