【问题标题】:Could not open or put a Hibernate Session in ValueStack: Cannot open connection无法在 ValueStack 中打开或放置休眠会话:无法打开连接
【发布时间】:2013-03-09 02:17:06
【问题描述】:

我使用 struts 和 hibernate 创建了应用程序。在 Eclipse IDE 中运行应用程序时出现以下错误:

org.hibernate.SessionException: Error! Please, check your JDBC/JDNI Configurations and Database Server avaliability. 

 Could not open or put a Hibernate Session in ValueStack: Cannot open connection
    com.googlecode.s2hibernate.struts2.plugin.interceptors.SessionTransactionInjectorInterceptor.intercept(SessionTransactionInjectorInterceptor.java:134)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)

有什么线索吗?

问候,

【问题讨论】:

  • 有什么线索可以克服这个错误吗?
  • org.hibernate.SessionException:错误!请检查您的 JDBC/JDNI 配置和数据库服务器的可用性。无法打开连接
  • 这是自定义错误信息吗?

标签: java mysql eclipse hibernate struts2


【解决方案1】:

你需要在我的 pom.xml 中添加一个 asm 和 cglib 的依赖。你添加了吗?请检查一次。

例如see here

【讨论】:

  • @user2189411 你检查我的答案了吗
  • 感谢您的回答 PSR。我在 Eclipse Indigo 中使用简单的动态项目。我没有使用 Maven 项目添加 POM.xml 文件。在这种情况下,我该如何解决我的问题?
  • @user2189411 没问题。你可以手动下载这些jarfiles然后添加到构建路径
  • 我添加了以下 jar 文件并完成了构建路径 antlr-2.7.6 commons-beanutils commons-collections commons-fileupload commons-io commons-lang commons-logging displaytag displaytag-export-poi dom4j ejb3 -persistence freemarker hibernate3 hibernate-annotations hibernate-commons-annotations hibernate-validator hsqldb itext iText javassist jcl104-over-slf4j jstl jta junit log4j mail mysql-connector-java ognl-2.7.3 poi-3.2-FINAL slf4j-api slf4jlog4j标准struts2 -convention-plugin struts2-core struts-dojo-plugin struts-fullhibernatecore-plugin xwork 我错过了任何 jar 文件吗?
  • 在上面的 cmets 中添加 jar 文件后,没有出现同样的错误。我错过了任何 jar 文件吗?
猜你喜欢
  • 2013-08-09
  • 2011-03-29
  • 2014-07-26
  • 2011-06-13
  • 2016-07-04
  • 2017-06-19
  • 2017-09-04
  • 1970-01-01
相关资源
最近更新 更多