Announcement Announcement Module
Collapse
No announcement yet.
UnExplicite log error from Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • UnExplicite log error from Spring

    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.

    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>&#40;EntityMetamodel.java&#58;108&#41;
    	at org.hibernate.persister.entity.BasicEntityPersister.<init>&#40;BasicEntityPersister.java&#58;400&#41;
    	at org.hibernate.persister.entity.SingleTableEntityPersister.<init>&#40;SingleTableEntityPersister.java&#58;104&#41;
    	at org.hibernate.persister.PersisterFactory.createClassPersister&#40;PersisterFactory.java&#58;55&#41;
    	at org.hibernate.impl.SessionFactoryImpl.<init>&#40;SessionFactoryImpl.java&#58;211&#41;
    	at org.hibernate.cfg.Configuration.buildSessionFactory&#40;Configuration.java&#58;1005&#41;
    	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory&#40;LocalSessionFactoryBean.java&#58;767&#41;
    	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet&#40;LocalSessionFactoryBean.java&#58;693&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods&#40;AbstractAutowireCapableBeanFactory.java&#58;1003&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;348&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;226&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;147&#41;
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference&#40;BeanDefinitionValueResolver.java&#58;176&#41;
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary&#40;BeanDefinitionValueResolver.java&#58;105&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues&#40;AbstractAutowireCapableBeanFactory.java&#58;957&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean&#40;AbstractAutowireCapableBeanFactory.java&#58;768&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;330&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;226&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;147&#41;
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;DefaultListableBeanFactory.java&#58;275&#41;
    	at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;317&#41;
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;80&#41;
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;65&#41;
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0&#40;Native Method&#41;
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance&#40;Unknown Source&#41;
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance&#40;Unknown Source&#41;
    	at java.lang.reflect.Constructor.newInstance&#40;Unknown Source&#41;
    	at org.springframework.beans.BeanUtils.instantiateClass&#40;BeanUtils.java&#58;100&#41;
    	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate&#40;SimpleInstantiationStrategy.java&#58;75&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor&#40;AbstractAutowireCapableBeanFactory.java&#58;614&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;312&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;226&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;147&#41;
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;DefaultListableBeanFactory.java&#58;275&#41;
    	at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;317&#41;
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;80&#41;
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;65&#41;
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;56&#41;
    	at com.eg.factory.ContextFactory.setTestContext&#40;ContextFactory.java&#58;21&#41;
    	at com.eg.BaseSpringHibernateTest.setUp&#40;BaseSpringHibernateTest.java&#58;45&#41;
    	at junit.framework.TestCase.runBare&#40;TestCase.java&#58;125&#41;
    	at junit.framework.TestResult$1.protect&#40;TestResult.java&#58;106&#41;
    	at junit.framework.TestResult.runProtected&#40;TestResult.java&#58;124&#41;
    	at junit.framework.TestResult.run&#40;TestResult.java&#58;109&#41;
    	at junit.framework.TestCase.run&#40;TestCase.java&#58;118&#41;
    	at junit.framework.TestSuite.runTest&#40;TestSuite.java&#58;208&#41;
    	at junit.framework.TestSuite.run&#40;TestSuite.java&#58;203&#41;
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests&#40;RemoteTestRunner.java&#58;478&#41;
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run&#40;RemoteTestRunner.java&#58;344&#41;
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main&#40;RemoteTestRunner.java&#58;196&#41;
    Any better way to log?

    Thanks

    Etienne.

  • #2
    In your case, Spring is just a wrapper for hibernate - pin-pointing the error inside the hbm file should be HB's job, not Spring's.

    Comment

    Working...
    X