BeanCurrentlyInCreationException:创建名为'scrService'的bean时出错

时间:2015-06-19 04:55:16

标签: spring quartz-scheduler ioc-container jboss-eap-6

对于我的spring ioc容器定义,我得到了以下错误。它基本上有一个Spring Quartz Scheduler Bean Definition。

这是错误的最终根本原因。

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

这是ApplicationContext-beans.xml配置

<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>

现在我已经评论了以下Quartz Scheduler Entry,所以它工作正常......

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

根据我对trace-log的解释,scrService有抽象实现......

请告知此情况......感谢您的建议......

0 个答案:

没有答案