Hi,
my application is based on Spring (1.2.7) and uses maven2 to resolve dependencies and deploy itself. All the unit tests were running fine when depending on
hibernate-3.2.0.cr1 and
hibernate-annotations-3.1beta9 (from ibiblio maven2 repository).
Upgrading to
hibernate-3.2.0.cr2 and
hibernate-annotations-3.2.0.cr1 (still from ibiblio maven2 repository) when I launch the suite of all the unit tests I get:
Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [springapp-servlet.xml]: Initialization of bean failed; nested exception is org.hibernate.cache.CacheException: Attempt to restart an already started EhCacheProvider. Use sessionFactory.close() between repeated calls to buildSessionFactory. Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider. Error from ehcache was: Cannot parseConfiguration CacheManager. Attempt to create a new instance of CacheManager using the diskStorePath "/tmp" which is already used by an existing CacheManager. The source of the configuration was classpath.
org.hibernate.cache.CacheException: Attempt to restart an already started EhCacheProvider. Use sessionFactory.close() between repeated calls to buildSessionFactory. Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider. Error from ehcache was: Cannot parseConfiguration CacheManager. Attempt to create a new instance of CacheManager using the diskStorePath "/tmp" which is already used by an existing CacheManager. The source of the configuration was classpath.
at org.hibernate.cache.EhCacheProvider.start(EhCacheProvider.java:133)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:180)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1213)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:825)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:751)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1091)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:396)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:277)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72)
......... [cut snippet]
If I launch one test case per time, it works.
And strangely enough,
I don't use EhCache at all!
Here it is my hibernate configuration is:
Code:
driverClassName=org.hsqldb.jdbcDriver
url=jdbc:hsqldb:mem:testdb
username=sa
password=
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.current_session_context_class=thread
hibernate.hbm2ddl.auto=create
cache.provider_class=org.hibernate.cache.NoCacheProvider
hibernate.show_sql=false
hibernate.jdbc.batch_size=0
hibernate.connection.pool_size=1
hibernate.lucene.index_dir=/tmp/lucene_tmp_index
As I said, it was all working before I just updated the dependencies.
Thanks in advance, let me know if you need some more infos,
Alessio Pace.
http://www.jroller.com/page/alessiopace