Question

The following exception is coming when I am trying to run an existing project. Any pointer will be very helpful.

Exception in thread "Thread-5" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/app_config/applicationContext-dao.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.HibernateTransactionManager]: Constructor threw exception; nested exception is java.lang.NullPointerException
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.j
ava:965)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactor
y.java:898)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java
:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:4
56)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.determineTransactionManager(TransactionAspectSupport.java:24
8)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:100)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.Hibern
ateTransactionManager]: Constructor threw exception; nested exception is java.lang.NullPointerException
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)                                                                                                                  48535,34      97%
Caused by: java.lang.NullPointerException
        at org.apache.commons.logging.LogFactory.getCachedFactory(LogFactory.java:979)
        at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:435)                                          48536,34      97%
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
                                                                                                                          48573,27-34   97%

below is how the bean is defined

<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
Was it helpful?

Solution

http://commons.apache.org/proper/commons-logging/apidocs/org/apache/commons/logging/LogFactory.html#getFactory()

See the link. It requires a commons-logging.properties do you have any file like that in classpath?

OTHER TIPS

İt can't find bean class and return nullpointerexception .

Check all class and package names are true and check your app'sname.hbm.xml file is true named . You have to put class name which you run in app'sname area ..

And check you mapped your app'sname.hbm.xml file into hibernate.cfg.xml file

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top