这个东西是用SSH开发,hibernate利用Query提供的两个方法进行分页,hibernate连接的数据库为oracle数据库,刚连上的时候操作一切正常,但使用上一段时间以后出现如下错误:
【在service中每次方法执行完毕都关闭了session,可是还会出现这样的问题感觉比较奇怪啊】2009-04-28 21:05:41,101 [http-8080-Processor22] [WARN] Error while extracting database product name - falling back to empty error codes
org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
192.168.166.15:1521:money
)
Caused by:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
192.168.166.15:1521:money
)
【在service中每次方法执行完毕都关闭了session,可是还会出现这样的问题感觉比较奇怪啊】2009-04-28 21:05:41,101 [http-8080-Processor22] [WARN] Error while extracting database product name - falling back to empty error codes
org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
192.168.166.15:1521:money
)
Caused by:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
192.168.166.15:1521:money
)
解决方案 »
- jfreechart中gantt显示位置不对
- struts2.0的validation框架里的带参数的国际化应该怎样处理?
- JFreeReport做报表问题!
- 超链接在传递带有&符号的字符串时不能正常显示
- http://localhost:8080/article/UserFiles/File/林三0(1).doc 不能打开?
- 一个关于Spring的初学简单问题!
- Spring 中<bean id ="test" class=""> 的class属性可以指定为一个抽象类吗?
- 求教一个spring事务超时控制的问题
- tomcat中sqlserver连接池的配置
- JSF h:outputLabel不显示内容
- applet读取服务器上的文件出错
- struts2 中上传文件 问题
应该是spring的配置问题吧
麻烦楼主能把你的hibernate的配置文件发来一下吗
<property name="driverClassName"
value="oracle.jdbc.OracleDriver">
</property> <property name="url"
value="jdbc:oracle:thin:@192.168.166.15:1521:money">
</property>
<property name="username" value="money"></property>
<property name="password" value="money"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="money" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>
com/dc/cms/hibernate/Id.hbm.xml
</value>
<value>
com/dc/cms/hibernate/TypeInfo.hbm.xml
</value>
</list>
</property>
</bean>
org.springframework.orm.hibernate3.support
Class HibernateDaoSupport
就不会出现没关闭的问题了,还可以配置事务!
因为需要分页,所以利用spring管理的dao.getSessionFactory().openSession()得到Session,然后利用Session,然后利用Query里的setFirstResult()和setMaxResults()设置分页,刚开始用着没有问题,可是用着用着就出现上边的错了。我再每次执行完毕以后都把session关闭,不会是关闭了Session的缘故吧!