user1179628
user1179628

Reputation: 1

[ERROR]org.springframework.beans.factory.BeanCreationException

when i run Java Web in tomcat6.0. i found this problem in time !

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CaseCache' defined in file [D:\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps\tpcPo\WEB-INF\classes\applicationContextCache.xml]: Cannot resolve reference to bean 'CaseDAO' while setting bean property 'caseDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CaseDAO' defined in file [D:\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps\tpcPo\WEB-INF\classes\applicationContextDao.xml]: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CaseDAO' defined in file [D:\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps\tpcPo\WEB-INF\classes\applicationContextDao.xml]: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 33 more
Caused by: java.lang.ExceptionInInitializerError
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:61)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
... 44 more

My applicationContextCache.xml

<bean id="CaseCache" class="com.aboveE.tpcPo.service.CacheService">
    <property name="caseDAO" ref="CaseDAO"/>
    <property name="offDocDAO" ref="OffDocDAO"/>
    <property name="caseQueryMap" ref="caseQueryCache" />
    <property name="officialQueryMap" ref="officialQueryCache" />
</bean>

My applicationContextDao.xml

<bean id="CaseDAO"
    class="com.aboveE.tpcPo.dao.CaseDAO">
    <property name="sessionFactory">
        <ref bean="sessionFactory" />
    </property>
</bean>

I'have already done a lot of research in google , but I can't resolve my problem...

please somebody can help me :(

Upvotes: 0

Views: 7571

Answers (2)

beny23
beny23

Reputation: 35008

The error message boils down to the following:

Error creating bean with name 'CaseDAO' defined in file:

The problem is with the CaseDAO bean.

Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError:

The problem is with the constructor.

Can you check whether the following is the case:

  • Does com.aboveE.tpcPo.dao.CaseDAO have a no-args constructor?
  • Is the constructor accessible (i.e. not private or protected, though Spring tries to make these constructors accessible)
  • Could the constructor have thrown an exception?
  • Is com.aboveE.tpcPo.dao.CaseDAO an abstract class?

Upvotes: 3

Mark Bramnik
Mark Bramnik

Reputation: 42441

it looks like you have an issue with your DAO. During its initialization(read, inside the constructor/initialization block, its own or its parent) there is an issue. Why don't you just debug it?

Upvotes: 1

Related Questions