解决org.hibernate.exception.GenericJDBCException: Cannot open connection
程序员文章站
2022-04-25 16:22:16
...
使用SSH开发项目时发现多次从后台取数据时就会报org.hibernate.exception.GenericJDBCException: Cannot open connection错误,解决办法如下:在web.xml中配置配置OpenSessionInViewFilter,将如下代码加入到web.xml中
问题结决。
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<!-- singleSession默认为true,若设为false则等于没用OpenSessionInView -->
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>OpenSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--Spring Context listener-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-*.xml</param-value>
</context-param>
问题结决。
上一篇: Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
下一篇: org.hibernate.exception.JDBCConnectionException: Cannot open connection
推荐阅读
-
解决eclipse中egit中的cannot open git-upload-pack问题
-
解决启动MongoDB错误:error while loading shared libraries: libstdc++.so.6:cannot open shared object file:
-
linux系统安装VMware(详细解决"Cannot open /dev/vmmon: No such file or directory"问题)
-
解决error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file
-
小马激活工具出现Cannot open file k:OEMSF 的解决方法
-
cv2报错ImportError: libXrender.so.1: cannot open shared object file 解决
-
解决 ImportError: libcublas.so.9.0: cannot open shared object file: No such file
-
错误解决:error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory,errorwhileloading_PHP教程
-
错误解决:error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory,errorwhileloading_PHP教程
-
解决启动MongoDB错误:error while loading shared libraries: libstdc++.so.6:cannot open shared object file: