org.springframework.beans.factory.BeanCreationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Hi I am trying to run the simple example. I am getting the datasource from JNDI and passing it to the Local Session Factory and I am getting this error. It seems the LocalSessionFactory does not have the corresponding method for JndiObjectFactoryBean. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- Error creating bean with name 'mySessionFactory' defined in class path resource [com/atomic/springjndi/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [javax.naming.Reference] to required type [javax.sql.DataSource] for property 'dataSource'] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- My application context file is <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="mySessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="dataSource"> <bean id="myTestDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>jdbc/atomicDB</value> </property> </bean> </property> <property name="mappingResources"> <list> <value>com/atomic/springjndi/Event.hbm.xml</value> </list> </property> </bean> <bean id="myEventDAO" class="com.atomic.springjndi.EventDAOImpl"> <property name="sessionFactory"> <ref bean="mySessionFactory" /> </property> </bean> </beans> -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- Full Error shows as below ---------------------------------------------------------------------- Client [INFO] XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [com/atomic/springjndi/applicationContext.xml] [INFO] ClassPathXmlApplicationContext - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=573960176]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [mySessionFactory,myEventDAO]; root of BeanFactory hierarchy [INFO] ClassPathXmlApplicationContext - 2 beans defined in application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=573960176] [INFO] ClassPathXmlApplicationContext - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.StaticMessageSource: {}] [INFO] ClassPathXmlApplicationContext - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@39ccaff3] [INFO] ClassPathXmlApplicationContext - Refreshing listeners [INFO] DefaultListableBeanFactory - Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [mySessionFactory,myEventDAO]; root of BeanFactory hierarchy] [INFO] DefaultListableBeanFactory - Creating shared instance of singleton bean 'mySessionFactory' [INFO] JndiObjectFactoryBean - Located object with JNDI name [jdbc/atomicDB]: value=[Reference Class Name: atomicDB Type: connectorName Content: atomicDB Type: recoveryClasspath Content: C:\Program Files\IBM\WebSphere Studio\Application Developer IE\v5.1.1\runtimes\ee_v51/lib/rsadapter.rar Type: FactoryJndiName Content: jdbc/atomicDB Address Type: dd AddressContents: ffffffac ffffffed 0 5 73 72 0 25 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 52 65 73 6f 75 72 63 65 ... Address Type: poolProps AddressContents: ffffffac ffffffed 0 5 73 72 0 27 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 43 6f 6e 6e 65 63 74 6f ... Address Type: configProps AddressContents: ffffffac ffffffed 0 5 73 72 0 23 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 43 6f 6e 6e 65 63 74 6f ... Address Type: mmProps AddressContents: ffffffac ffffffed 0 5 73 72 0 14 6a 61 76 61 2e 75 74 69 6c 2e 50 72 6f 70 65 72 74 69 65 73 39 12 ffffffd0 7a ... Address Type: dsProps AddressContents: ffffffac ffffffed 0 5 73 72 0 14 6a 61 76 61 2e 75 74 69 6c 2e 50 72 6f 70 65 72 74 69 65 73 39 12 ffffffd0 7a ... Address Type: mcfProps AddressContents: ffffffac ffffffed 0 5 73 72 0 2d 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 4d 61 6e 61 67 65 64 43 ... Address Type: mbeanProps AddressContents: ffffffac ffffffed 0 5 73 72 0 1a 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 4d 42 65 61 6e 50 72 6f ... ] [INFO] DefaultListableBeanFactory - Destroying singletons in factory {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [mySessionFactory,myEventDAO]; root of BeanFactory hierarchy} [INFO] DefaultListableBeanFactory - Destroying inner beans in factory {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [mySessionFactory,myEventDAO]; root of BeanFactory hierarchy} org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in class path resource [com/atomic/springjndi/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [javax.naming.Reference] to required type [javax.sql.DataSource] for property 'dataSource'] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:840) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:648) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:236) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:255) 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.atomic.springjndi.EventTestClient.main(EventTestClient.java:27) Exception in thread "P=417141:O=0:CT" ----------------------------------------------------------------------
    via by Deepak Kalra,
  • Hi I am trying to run the simple example. I am getting the datasource from JNDI and passing it to the Local Session Factory and I am getting this error. It seems the LocalSessionFactory does not have the corresponding method for JndiObjectFactoryBean. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- Error creating bean with name 'mySessionFactory' defined in class path resource [com/atomic/springjndi/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [javax.naming.Reference] to required type [javax.sql.DataSource] for property 'dataSource'] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- My application context file is <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="mySessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="dataSource"> <bean id="myTestDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>jdbc/atomicDB</value> </property> </bean> </property> <property name="mappingResources"> <list> <value>com/atomic/springjndi/Event.hbm.xml</value> </list> </property> </bean> <bean id="myEventDAO" class="com.atomic.springjndi.EventDAOImpl"> <property name="sessionFactory"> <ref bean="mySessionFactory" /> </property> </bean> </beans> -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- Full Error shows as below ---------------------------------------------------------------------- Client [INFO] XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [com/atomic/springjndi/applicationContext.xml] [INFO] ClassPathXmlApplicationContext - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=573960176]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [mySessionFactory,myEventDAO]; root of BeanFactory hierarchy [INFO] ClassPathXmlApplicationContext - 2 beans defined in application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=573960176] [INFO] ClassPathXmlApplicationContext - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.StaticMessageSource: {}] [INFO] ClassPathXmlApplicationContext - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@39ccaff3] [INFO] ClassPathXmlApplicationContext - Refreshing listeners [INFO] DefaultListableBeanFactory - Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [mySessionFactory,myEventDAO]; root of BeanFactory hierarchy] [INFO] DefaultListableBeanFactory - Creating shared instance of singleton bean 'mySessionFactory' [INFO] JndiObjectFactoryBean - Located object with JNDI name [jdbc/atomicDB]: value=[Reference Class Name: atomicDB Type: connectorName Content: atomicDB Type: recoveryClasspath Content: C:\Program Files\IBM\WebSphere Studio\Application Developer IE\v5.1.1\runtimes\ee_v51/lib/rsadapter.rar Type: FactoryJndiName Content: jdbc/atomicDB Address Type: dd AddressContents: ffffffac ffffffed 0 5 73 72 0 25 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 52 65 73 6f 75 72 63 65 ... Address Type: poolProps AddressContents: ffffffac ffffffed 0 5 73 72 0 27 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 43 6f 6e 6e 65 63 74 6f ... Address Type: configProps AddressContents: ffffffac ffffffed 0 5 73 72 0 23 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 43 6f 6e 6e 65 63 74 6f ... Address Type: mmProps AddressContents: ffffffac ffffffed 0 5 73 72 0 14 6a 61 76 61 2e 75 74 69 6c 2e 50 72 6f 70 65 72 74 69 65 73 39 12 ffffffd0 7a ... Address Type: dsProps AddressContents: ffffffac ffffffed 0 5 73 72 0 14 6a 61 76 61 2e 75 74 69 6c 2e 50 72 6f 70 65 72 74 69 65 73 39 12 ffffffd0 7a ... Address Type: mcfProps AddressContents: ffffffac ffffffed 0 5 73 72 0 2d 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 4d 61 6e 61 67 65 64 43 ... Address Type: mbeanProps AddressContents: ffffffac ffffffed 0 5 73 72 0 1a 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 4d 42 65 61 6e 50 72 6f ... ] [INFO] DefaultListableBeanFactory - Destroying singletons in factory {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [mySessionFactory,myEventDAO]; root of BeanFactory hierarchy} [INFO] DefaultListableBeanFactory - Destroying inner beans in factory {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [mySessionFactory,myEventDAO]; root of BeanFactory hierarchy} org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in class path resource [com/atomic/springjndi/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [javax.naming.Reference] to required type [javax.sql.DataSource] for property 'dataSource'] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:840) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:648) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:236) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:255) 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.atomic.springjndi.EventTestClient.main(EventTestClient.java:27) Exception in thread "P=417141:O=0:CT" ----------------------------------------------------------------------
    via by Deepak Kalra,
  • MongoDB with Repositories
    via by Unknown author,
    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in class path resource [com/atomic/springjndi/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [javax.naming.Reference] to required type [javax.sql.DataSource] for property 'dataSource'] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:840) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:648) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:236) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:255) 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.atomic.springjndi.EventTestClient.main(EventTestClient.java:27)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    batwalrus76batwalrus76
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    238 more bugmates