这个东西是用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
)

解决方案 »

  1.   

    没有得到连接
    应该是spring的配置问题吧
      

  2.   

    Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: 应该是hibernate的配置文件出了问题 
    麻烦楼主能把你的hibernate的配置文件发来一下吗 
      

  3.   

    JAVA技术全功略(85835578)高级群   现在开始招人了啊   能更多的人一起交流了  希望大家一起交流JAVA技术经验 [color=#FF0000][/color]
      

  4.   

    spring中HIBERNATE的配置文件 大家看看哦<bean id="money" class="org.apache.commons.dbcp.BasicDataSource">
      <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> 
      

  5.   

    你既然把hibernate给spring管理了就可以用Spring的
    org.springframework.orm.hibernate3.support 
    Class HibernateDaoSupport
    就不会出现没关闭的问题了,还可以配置事务!
      

  6.   

    会不会是Hibernate的映射文件有错误啊
      

  7.   


    因为需要分页,所以利用spring管理的dao.getSessionFactory().openSession()得到Session,然后利用Session,然后利用Query里的setFirstResult()和setMaxResults()设置分页,刚开始用着没有问题,可是用着用着就出现上边的错了。我再每次执行完毕以后都把session关闭,不会是关闭了Session的缘故吧!