Hi,
is there a way to make Spring error more "explicite"? I know Spring is there to help developer, but the error message I get from Spring is far from being explicite.
I have to manage more than 10 Spring configuration files plus 50 Hibernate configuration (mapping) files, and when I have an error in one of theses configuration I get a long and unsignificant error message.
Here an example of the kind of error I get. Note that the "astInstrumentOssDao" is irrelevant because it is the first DAO load by Spring and any error in the Hibernate 50 config file will make an error for "astInstrumentOssDao".
For this example, I have manage to find the problem, but it is not always as easy (the useType class SybasePatchNumericInt do not exist, or something like this). But it would be great thate Spring explicitly pin-point in what file the error occure: in ABCTableMapping.hbm.xml line 54... per example.
Any better way to log?Code:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mainContextBean' defined in class path resource [test-good-Name-main-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.context.support.ClassPathXmlApplicationContext]; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'astInstrumentOssDao' defined in class path resource [instrument-dao-context.xml]: Can't resolve reference to bean 'bdCorpoSessionFactory' while setting property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bdCorpoSessionFactory' defined in class path resource [sessionFactory-onlyGoodName-context.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Bad identifier type: com.eg.usertype.sybasepatch.SybasePatchNumericInt org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.context.support.ClassPathXmlApplicationContext]; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'astInstrumentOssDao' defined in class path resource [instrument-dao-context.xml]: Can't resolve reference to bean 'bdCorpoSessionFactory' while setting property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bdCorpoSessionFactory' defined in class path resource [sessionFactory-onlyGoodName-context.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Bad identifier type: com.eg.usertype.sybasepatch.SybasePatchNumericInt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'astInstrumentOssDao' defined in class path resource [instrument-dao-context.xml]: Can't resolve reference to bean 'bdCorpoSessionFactory' while setting property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bdCorpoSessionFactory' defined in class path resource [sessionFactory-onlyGoodName-context.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Bad identifier type: com.eg.usertype.sybasepatch.SybasePatchNumericInt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bdCorpoSessionFactory' defined in class path resource [sessionFactory-onlyGoodName-context.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Bad identifier type: com.eg.usertype.sybasepatch.SybasePatchNumericInt org.hibernate.MappingException: Bad identifier type: com.eg.usertype.sybasepatch.SybasePatchNumericInt at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:72) at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:42) at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:108) at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:211) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:767) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:693) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1003) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:348) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:957) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:768) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:330) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:80) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:75) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:614) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:312) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:80) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:56) at com.eg.factory.ContextFactory.setTestContext(ContextFactory.java:21) at com.eg.BaseSpringHibernateTest.setUp(BaseSpringHibernateTest.java:45) at junit.framework.TestCase.runBare(TestCase.java:125) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Thanks
Etienne.


Reply With Quote