-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Weird problem with Hibernate 3.1.3 and SQL Server 2000
PostPosted: Thu Mar 29, 2007 3:53 pm 
Newbie

Joined: Thu Mar 29, 2007 3:16 pm
Posts: 7
Location: Brasil
Hibernate version: 3.1.3

Name and version of the database you are using: MS SQL Server 2000

Hello there. I'm installing a JSF + Hibernate application on a server running Windows Server 2003 R2 with SQL Server 2000. Last friday I installed the same application on another server with the same configuration and all went ok. But, this time, I'm getting some weird "errors" with the c3p0 pooling. The message it gives is the following:

Code:
INFO [http-8085-Processor24] (PoolBackedDataSource.java:257) - Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@10f80a9 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@4f0f97 [ acquireIncrement -> 1, acquireRetryAttempts -> 60, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 4f0f97, idleConnectionTestPeriod -> 100, initialPoolSize -> 3, maxIdleTime -> 180, maxPoolSize -> 5, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@68dc2d [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 68dc2d, jdbcUrl -> null, properties -> {autocommit=true, release_mode=after_statement} ], preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ], factoryClassLocation -> null, identityToken -> 10f80a9, numHelperThreads -> 3 ]
WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] (BasicResourcePool.java:1222) - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@f66abc -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (60).
WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] (BasicResourcePool.java:1222) - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1d97efc -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (60).
WARN [http-8085-Processor24] (SettingsFactory.java:103) - Could not obtain connection metadata
java.sql.SQLException: Connections could not be acquired from the underlying database!
   at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:104)
   at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:236)
   at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:94)
   at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
   at com.lecom.gcontatos.database.HSFactory.getCurrentSession(HSFactory.java:52)
   at com.lecom.gcontatos.dao.LecRepresentanteDAO.selectPK(LecRepresentanteDAO.java:72)
   at com.lecom.gcontatos.bc.LecRepresentanteBC.consultarPK(LecRepresentanteBC.java:31)
   at com.lecom.gcontatos.util.bean.LoginBean.atualizarRepresentantes(LoginBean.java:230)
   at com.lecom.gcontatos.util.bean.LoginBean.getCarregar(LoginBean.java:139)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
   at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
   at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:532)
   at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
   at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
   at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1076)
   at javax.faces.webapp.UIComponentTag.isSuppressed(UIComponentTag.java:884)
   at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:313)
   at org.apache.jsp.pages.carregar_jsp._jspx_meth_h_panelGroup_0(carregar_jsp.java:99)
   at org.apache.jsp.pages.carregar_jsp._jspService(carregar_jsp.java:62)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
   at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
   at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
   at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
   at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
   at java.lang.Thread.run(Thread.java:595)
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
   at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(BasicResourcePool.java:970)
   at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:208)
   at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:232)
   ... 67 more



Then, the application just hangs on and the following messages is showed in the console repetitively:

Code:
INFO [http-8085-Processor24] (PoolBackedDataSource.java:257) - Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@ad8dbc [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@18526aa [ acquireIncrement -> 1, acquireRetryAttempts -> 60, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 18526aa, idleConnectionTestPeriod -> 100, initialPoolSize -> 3, maxIdleTime -> 180, maxPoolSize -> 5, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@cfefc0 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> cfefc0, jdbcUrl -> null, properties -> {autocommit=true, release_mode=after_statement} ], preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ], factoryClassLocation -> null, identityToken -> ad8dbc, numHelperThreads -> 3 ]


Here's some more console information that can be useful:

This occurs before the error:
Code:
INFO [http-8085-Processor24] (Configuration.java:1308) - configuring from resource: /hibernate.cfg.xml
INFO [http-8085-Processor24] (Configuration.java:1285) - Configuration resource: /hibernate.cfg.xml
INFO [http-8085-Processor24] (Configuration.java:1419) - Configured SessionFactory: null
INFO [http-8085-Processor24] (C3P0ConnectionProvider.java:50) - C3P0 using driver: null at URL: null
INFO [http-8085-Processor24] (C3P0ConnectionProvider.java:51) - Connection properties: {autocommit=true, release_mode=after_statement}
INFO [http-8085-Processor24] (C3P0ConnectionProvider.java:54) - autocommit mode: true
WARN [http-8085-Processor24] (C3P0ConnectionProvider.java:57) - No JDBC Driver class was specified by property hibernate.connection.driver_class


Hibernate then seems to "restart" and try to map the hbm.xml files again, resulting in the following exception:

Code:
org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.lecom.gcontatos.bean.LecAcompanha


My hibernate.cfg.xml: (the db access info is provided at execution time, loaded from an encrypted propertie file)

Code:
<hibernate-configuration>
    <session-factory>
        <!-- Configuracoes de pool de conexao -->
   
      <property name="c3p0.min_size">3</property>
      <property name="c3p0.max_size">5</property>
      <property name="c3p0.timeout">180</property>
      <property name="c3p0.idle_test_period">100</property>     
   
        <!-- Configuracoes de debug -->
       <property name="hibernate.show_sql">true</property>
      <property name="hibernate.generate_statistics">false</property>
      <property name="hibernate.use_sql_comments">false</property>
      <property name="hibernate.transaction.flush_before_completion">true</property>
      <property name="hibernate.connection.release_mode">after_statement</property>
      <property name="hibernate.cache.use_second_level_cache">true</property>
      <property name="hibernate.cache.use_structured_entries">true</property>
      <property name="hibernate.connection.autocommit">true</property>
      <property name="hibernate.cglib.use_reflection_optimizer">true</property>
      <property name="hibernate.cache.use_query_cache">true</property>
       <property name="cache.use_minimal_puts">true</property>
        <property name="max_fetch_depth">3</property>
               
    </session-factory>
</hibernate-configuration>


The bean mappings are also provided at execution time, via addCacheableFile.

I tried to use an c3p0 configuration file for a "workaround" I've found on the internet:

Code:
c3p0.acquireRetryDelay=1000
c3p0.acquireRetryAttempts=60
c3p0.breakAfterAcquireFailure=false


In that same server, at the same time, I have another application with the same c3p0 and hibernate configuration, accessing a database on the same SQL Server and all is running OK. I've created both databases using the same user, same configurations and privileges.

I can access the database via tools like SQL Server Enterprise Manager, Query Analyzer and WinSQL and I'm able to establish "pure" JDBC connections and execute queries without Hibernate.

I'm really confused...

P.S.: I'm already using the SelectMethod=Cursor "workaround".


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.