BeanCurrentlyInCreationException: Error creating bean with name 'scrService'

3.2k views Asked by At

I am getting following Error, for my spring ioc container definition. It basically has a Spring Quartz Scheduler Bean Definition.

This is the final root cause of the error.

Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'scrService': org.springframework.beans.factory.FactoryBeanNotInitializedException: FactoryBean is not fully initialized yet
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:126) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1467) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
    ... 114 more

Here is ApplicationContext-beans.xml configuration

<bean id="scheduler"
    class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
    destroy-method="destroy">
    <property name="schedulerName">
        <value>${org.quartz.scheduler.instanceName}</value>
    </property>
    <property name="autoStartup" value="true" />
    <property name="startupDelay" value="10" />
    <!-- To prevent picking up jobs from the database, please remove the line below -->
    <property name="dataSource" ref="dataSource" />
    <property name="transactionManager" ref="transactionManager"/>
    <property name="taskExecutor" ref="senderTaskExecutor" />
    <property name="waitForJobsToCompleteOnShutdown" value="true"></property>
    <property name="quartzProperties">
        <props>
            <prop key="org.quartz.scheduler.instanceId">
                ${org.quartz.scheduler.instanceId}
            </prop>
            <!-- add key="org.quartz.jobStore.class" with value "org.quartz.simpl.RAMJobStore" for an in memory scheduler -->
            <!-- Remove the 3 lines below for an in memory scheduler -->
            <prop key="org.quartz.jobStore.driverDelegateClass">
                ${org.quartz.jobStore.driverDelegateClass}
            </prop>
            <prop key="org.quartz.jobStore.isClustered">
                ${org.quartz.jobStore.isClustered}
            </prop>
            <prop
                key="org.quartz.jobStore.clusterCheckinInterval">
                ${org.quartz.jobStore.clusterCheckinInterval}
            </prop>
            <prop key="org.quartz.jobStore.useProperties">
                ${org.quartz.jobStore.useProperties}
            </prop>
        </props>
    </property>
    <property name="schedulerContextAsMap">
        <map>
            <!--<entry key="scrService">
                <ref bean="scrService" />
            </entry>-->
            <entry key="numberLevelService">
                <ref bean="numberLevelService" />
            </entry>
            <!--
            ...
            -->             
        </map>
    </property>
</bean> 
<!--
...
--> 
<bean id="scrService" parent="baseServiceTransactionProxy">
    <property name="target" ref="scrServiceTarget"></property>
</bean> <!--abstract does not have Impl associated for scrServiceTarget or some problem-->

<bean id="numberLevelService" class="com.ding.dong.NumberLevelControllerImpl" factory-method="getInstance" lazy-init="true">
    <constructor-arg ref="dataSource"></constructor-arg>
</bean>

<bean id="scrServiceTarget"
    class="com.ding.dong.scrServiceImpl">
    <property name="pageSizeFactor">
        <value>${service.sender.pageSizeFactor}</value>
    </property>
    <property name="tpsFactor">
        <value>${service.sender.tpsFactor}</value>
    </property>
    <property name="scrDao" ref="scrDao"></property>
    <property name="scrRuntimeDao" ref="scrRuntimeDao"></property>
    <property name="scrReportDao" ref="scrReportDao"></property>
    <property name="scrTemplateDao"
        ref="scrTemplateDao">
    </property>
    <property name="schedulerService" ref="schedulerService"></property>
    <property name="shortCodeManagerService"
        ref="shortCodeManagerService">
    </property>
    <property name="userRoleService" ref="userRoleService"></property>
    <!-- To prevent connecting to JMS, please remove the line below -->
    <property name="messageSenderService"
        ref="messageSenderService">
    </property>
</bean>

<bean id="baseServiceTransactionProxy"
    class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
    abstract="true">
    <property name="transactionManager" ref="transactionManager" />
    <property name="transactionAttributes">
        <props>
            <prop key="scheduleSCR">
                PROPAGATION_REQUIRED,-SCRServiceRuntimeException
            </prop>
            <prop key="removeScheduledSCR">
                PROPAGATION_REQUIRED,-SCRServiceRuntimeException
            </prop>
            <prop key="extendInProgressSCR">
                PROPAGATION_REQUIRED,-SCRServiceRuntimeException
            </prop>
            <prop key="stopInProgressSCR">
                PROPAGATION_REQUIRED,-SCRServiceRuntimeException
            </prop>
            <prop key="retrieveSCRForExecution">
                PROPAGATION_REQUIRED,-SCRServiceRuntimeException
            </prop>
            <prop key="updateSCRState">
                PROPAGATION_REQUIRED,-SCRServiceRuntimeException
            </prop>
            <prop key="process*">
                PROPAGATION_REQUIRED,-SCRServiceRuntimeException
            </prop>
            <prop key="updateMessageLogForContestWinners">
                PROPAGATION_REQUIRED,-SCRServiceRuntimeException
            </prop>
            <prop key="retrieveSCR">
                PROPAGATION_REQUIRED,readOnly
            </prop>
            <prop key="retrieveTemplate">
                PROPAGATION_REQUIRED,readOnly
            </prop>
            <prop key="getScheduledSCRsMessageCount">
                PROPAGATION_REQUIRED,readOnly
            </prop>
            <prop key="isUserQuotaExceeded">
                PROPAGATION_REQUIRED,readOnly
            </prop>
            <prop key="retrieveActiveSCR*">
                PROPAGATION_REQUIRED,readOnly
            </prop>
            <prop key="retrieveSCRInfo">
                PROPAGATION_REQUIRED,readOnly
            </prop>
            <prop key="scheduleTask">
                PROPAGATION_REQUIRED,-SchedulerServiceRuntimeException
            </prop>
            <prop key="*ScheduledTask">
                PROPAGATION_REQUIRED,-SchedulerServiceRuntimeException
            </prop>
            <prop key="updateTaskSchedule">
                PROPAGATION_REQUIRED,-SchedulerServiceRuntimeException
            </prop>
        </props>
    </property>
    <property name="preInterceptors">
        <ref bean="performanceInterceptor" />
    </property>
</bean>

For now I had commented the following Quartz Scheduler Entry, So it works fine...

<!--<entry key="scrService">
    <ref bean="scrService" />
</entry>-->

As per my interpretation of trace-log, scrService has abstract implementation...

Please advise about this situation... Thanks for your suggestions....

0

There are 0 answers