tapestry5集成spring遇到一个实例不了的bean?

java 代码

      今天想集成tapestry5,spring ,hibernate,jdbc.缺遇到了一个奇怪的问题.现在我把spring的配置XML帖一下

xml 代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"   
  3.     "http://www.springframework.org/dtd/spring-beans.dtd">  
  4.   
  5. <beans>  
  6.     <!-- Transction Intercetor's Template -->  
  7.     <bean id="transactionIntercetorTemplate" abstract="true">  
  8.         <property name="transactionAttributes">  
  9.             <props>  
  10.                 <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>  
  11.                 <prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>  
  12.                 <prop key="check*">PROPAGATION_REQUIRED,readOnly</prop>  
  13.                 <prop key="insert*">PROPAGATION_REQUIRED, -Exception</prop>  
  14.                 <prop key="update*">PROPAGATION_REQUIRED, -Exception</prop>  
  15.                 <prop key="delete*">PROPAGATION_REQUIRED, -Exception</prop>  
  16.                 <prop key="save*">PROPAGATION_REQUIRED, -Exception</prop>  
  17.                 <prop key="*">PROPAGATION_REQUIRED, -Exception</prop>  
  18.             </props>  
  19.         </property>  
  20.     </bean>  
  21.   
  22.     <!-- Hibernate Transaction Interceptor Definition -->          
  23.     <bean id="hibernateTransactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor" parent="transactionIntercetorTemplate">  
  24.         <property name="transactionManager">  
  25.             <bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">  
  26.                 <property name="sessionFactory">  
  27.                     <ref bean="sessionFactory" />  
  28.                 </property>  
  29.             </bean>  
  30.         </property>  
  31.     </bean>  
  32.   
  33.     <!-- Jdbc Transaction Interceptor Definition -->  
  34.     <bean id="jdbcTransactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor" parent="transactionIntercetorTemplate">  
  35.         <property name="transactionManager">  
  36.             <bean id="jdbcTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">  
  37.                 <property name="dataSource">  
  38.                     <ref bean="dataSource" />  
  39.                 </property>  
  40.             </bean>  
  41.         </property>  
  42.     </bean>  
  43.   
  44.     <!-- Auto Proxy Creator Definition -->  
  45.     <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">  
  46.         <property name="interceptorNames">  
  47.             <list>  
  48.                 <idref bean="hibernateTransactionInterceptor" />  
  49.                 <idref bean="jdbcTransactionInterceptor" />  
  50.             </list>  
  51.         </property>  
  52.          
  53.         <property name="beanNames">  
  54.             <list>  
  55.                 <!-- Add Service name to here for proxy begin -->  
  56.                 <idref bean="userService"/>  
  57.                 <!-- Add Service name to here for proxy end -->  
  58.             </list>  
  59.         </property>  
  60.     </bean>  
  61.   
  62.     <!-- hibernateDao Template, all use hibernate transaction manager should extends it -->  
  63.     <bean id="hibernateDaoTemplate" abstract="true">  
  64.         <property name="sessionFactory">  
  65.             <ref bean="sessionFactory" />  
  66.         </property>  
  67.     </bean>  
  68.   
  69.     <!-- jdbcDao Template, all use jdbc transaction manager should extends it -->  
  70.     <bean id="jdbcDaoTemplate" abstract="true">  
  71.         <property name="dataSource">  
  72.             <ref bean="dataSource" />  
  73.         </property>  
  74.     </bean>  
  75. </beans>  

报了以下错误,说不能创建这个bean.

4:15:09.250 ERROR! [main] org.apache.tapestry.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:64) >14> Construction of service ServletApplicationInitializer failed: Unable to instantiate class org.apache.tapestry.services.TapestryModule as a module builder: Error creating bean with name 'transactionIntercetorTemplate': Bean definition is abstract
java.lang.RuntimeException: Unable to instantiate class org.apache.tapestry.services.TapestryModule as a module builder: Error creating bean with name 'transactionIntercetorTemplate': Bean definition is abstract
 at org.apache.tapestry.ioc.internal.ModuleImpl.instantiateModuleBuilder(ModuleImpl.java:348)
 at org.apache.tapestry.ioc.internal.ModuleImpl.getModuleBuilder(ModuleImpl.java:273)
 at org.apache.tapestry.ioc.internal.ServiceResourcesImpl.getModuleBuilder(ServiceResourcesImpl.java:106)
 at org.apache.tapestry.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:61)
 at org.apache.tapestry.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:31)
 at org.apache.tapestry.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:49)
 at org.apache.tapestry.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:54)
 at org.apache.tapestry.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
 at org.apache.tapestry.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:61)
 at $ServletApplicationInitializer_1134ceb811c._delegate($ServletApplicationInitializer_1134ceb811c.java)
 at $ServletApplicationInitializer_1134ceb811c.initializeApplication($ServletApplicationInitializer_1134ceb811c.java)
 at org.apache.tapestry.TapestryFilter.init(TapestryFilter.java:86)
 at org.mortbay.jetty.servlet.FilterHolder.start(FilterHolder.java:71)
 at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:310)
 at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:509)
 at org.mortbay.util.Container.start(Container.java:72)
 at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
 at org.mortbay.util.Container.start(Container.java:72)
 at com.iw.plugins.jettyrunner.PluginRunner.launch(PluginRunner.java:282)
 at com.iw.plugins.jettyrunner.PluginRunner.launch(PluginRunner.java:104)
 at com.iw.plugins.jettyrunner.PluginRunner.main(PluginRunner.java:75)
Caused by: org.springframework.beans.factory.BeanIsAbstractException: Error creating bean with name 'transactionIntercetorTemplate': Bean definition is abstract
 at org.springframework.beans.factory.support.AbstractBeanFactory.checkMergedBeanDefinition(AbstractBeanFactory.java:767)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:220)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
 at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:537)
 at org.apache.tapestry.internal.spring.SpringModuleDef$1.getBean(SpringModuleDef.java:57)
 at org.apache.tapestry.internal.spring.SpringModuleDef$1.getServiceInterface(SpringModuleDef.java:78)
 at org.apache.tapestry.ioc.internal.ModuleImpl.findServiceIdsForInterface(ModuleImpl.java:148)
 at org.apache.tapestry.ioc.internal.RegistryImpl.findServiceIdsForInterface(RegistryImpl.java:470)
 at org.apache.tapestry.ioc.internal.RegistryImpl.getService(RegistryImpl.java:439)
 at org.apache.tapestry.ioc.services.TapestryIOCModule$2.provide(TapestryIOCModule.java:132)
 at $ObjectProvider_1134ceb8123.provide($ObjectProvider_1134ceb8123.java)
 at $ObjectProvider_1134ceb811d.provide($ObjectProvider_1134ceb811d.java)
 at org.apache.tapestry.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:550)
 at org.apache.tapestry.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:557)
 at org.apache.tapestry.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:50)
 at org.apache.tapestry.ioc.internal.util.InternalUtils.calculateParameterValue(InternalUtils.java:217)
 at org.apache.tapestry.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:248)
 at org.apache.tapestry.ioc.internal.ModuleImpl.instantiateModuleBuilder(ModuleImpl.java:327)
 ... 20 more

14:15:09.265 INFO   [main] org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:152) >10> Initializing filter 'OpenSessionInViewFilter'
14:15:09.296 INFO   [main] org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:177) >10> Filter 'OpenSessionInViewFilter' configured successfully
org.mortbay.util.MultiException[java.lang.RuntimeException: Exception constructing service 'ServletApplicationInitializer': Unable to instantiate class org.apache.tapestry.services.TapestryModule as a module builder: Error creating bean with name 'transactionIntercetorTemplate': Bean definition is abstract]
 at org.mortbay.http.HttpServer.doStart(HttpServer.java:686)
 at org.mortbay.util.Container.start(Container.java:72)
 at com.iw.plugins.jettyrunner.PluginRunner.launch(PluginRunner.java:282)
 at com.iw.plugins.jettyrunner.PluginRunner.launch(PluginRunner.java:104)
 at com.iw.plugins.jettyrunner.PluginRunner.main(PluginRunner.java:75)
java.lang.RuntimeException: Exception constructing service 'ServletApplicationInitializer': Unable to instantiate class org.apache.tapestry.services.TapestryModule as a module builder: Error creating bean with name 'transactionIntercetorTemplate': Bean definition is abstract
 at org.apache.tapestry.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:69)
 at $ServletApplicationInitializer_1134ceb811c._delegate($ServletApplicationInitializer_1134ceb811c.java)
 at $ServletApplicationInitializer_1134ceb811c.initializeApplication($ServletApplicationInitializer_1134ceb811c.java)
 at org.apache.tapestry.TapestryFilter.init(TapestryFilter.java:86)
 at org.mortbay.jetty.servlet.FilterHolder.start(FilterHolder.java:71)
 at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:310)
 at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:509)
 at org.mortbay.util.Container.start(Container.java:72)
 at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
 at org.mortbay.util.Container.start(Container.java:72)
 at com.iw.plugins.jettyrunner.PluginRunner.launch(PluginRunner.java:282)
 at com.iw.plugins.jettyrunner.PluginRunner.launch(PluginRunner.java:104)
 at com.iw.plugins.jettyrunner.PluginRunner.main(PluginRunner.java:75)
Caused by: java.lang.RuntimeException: Unable to instantiate class org.apache.tapestry.services.TapestryModule as a module builder: Error creating bean with name 'transactionIntercetorTemplate': Bean definition is abstract
 at org.apache.tapestry.ioc.internal.ModuleImpl.instantiateModuleBuilder(ModuleImpl.java:348)
 at org.apache.tapestry.ioc.internal.ModuleImpl.getModuleBuilder(ModuleImpl.java:273)
 at org.apache.tapestry.ioc.internal.ServiceResourcesImpl.getModuleBuilder(ServiceResourcesImpl.java:106)
 at org.apache.tapestry.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:61)
 at org.apache.tapestry.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:31)
 at org.apache.tapestry.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:49)
 at org.apache.tapestry.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:54)
 at org.apache.tapestry.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
 at org.apache.tapestry.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:61)
 ... 12 more
Caused by: org.springframework.beans.factory.BeanIsAbstractException: Error creating bean with name 'transactionIntercetorTemplate': Bean definition is abstract
 at org.springframework.beans.factory.support.AbstractBeanFactory.checkMergedBeanDefinition(AbstractBeanFactory.java:767)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:220)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
 at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:537)
 at org.apache.tapestry.internal.spring.SpringModuleDef$1.getBean(SpringModuleDef.java:57)
 at org.apache.tapestry.internal.spring.SpringModuleDef$1.getServiceInterface(SpringModuleDef.java:78)
 at org.apache.tapestry.ioc.internal.ModuleImpl.findServiceIdsForInterface(ModuleImpl.java:148)
 at org.apache.tapestry.ioc.internal.RegistryImpl.findServiceIdsForInterface(RegistryImpl.java:470)
 at org.apache.tapestry.ioc.internal.RegistryImpl.getService(RegistryImpl.java:439)
 at org.apache.tapestry.ioc.services.TapestryIOCModule$2.provide(TapestryIOCModule.java:132)
 at $ObjectProvider_1134ceb8123.provide($ObjectProvider_1134ceb8123.java)
 at $ObjectProvider_1134ceb811d.provide($ObjectProvider_1134ceb811d.java)
 at org.apache.tapestry.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:550)
 at org.apache.tapestry.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:557)
 at org.apache.tapestry.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:50)
 at org.apache.tapestry.ioc.internal.util.InternalUtils.calculateParameterValue(InternalUtils.java:217)
 at org.apache.tapestry.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:248)
 at org.apache.tapestry.ioc.internal.ModuleImpl.instantiateModuleBuilder(ModuleImpl.java:327)
 ... 20 more
java.lang.RuntimeException: Exception constructing service 'ServletApplicationInitializer': Unable to instantiate class org.apache.tapestry.services.TapestryModule as a module builder: Error creating bean with name 'transactionIntercetorTemplate': Bean definition is abstract
 at org.apache.tapestry.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:69)
 at $ServletApplicationInitializer_1134ceb811c._delegate($ServletApplicationInitializer_1134ceb811c.java)
 at $ServletApplicationInitializer_1134ceb811c.initializeApplication($ServletApplicationInitializer_1134ceb811c.java)
 at org.apache.tapestry.TapestryFilter.init(TapestryFilter.java:86)
 at org.mortbay.jetty.servlet.FilterHolder.start(FilterHolder.java:71)
 at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:310)
 at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:509)
 at org.mortbay.util.Container.start(Container.java:72)
 at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
 at org.mortbay.util.Container.start(Container.java:72)
 at com.iw.plugins.jettyrunner.PluginRunner.launch(PluginRunner.java:282)
 at com.iw.plugins.jettyrunner.PluginRunner.launch(PluginRunner.java:104)
 at com.iw.plugins.jettyrunner.PluginRunner.main(PluginRunner.java:75)
Caused by: java.lang.RuntimeException: Unable to instantiate class org.apache.tapestry.services.TapestryModule as a module builder: Error creating bean with name 'transactionIntercetorTemplate': Bean definition is abstract
 at org.apache.tapestry.ioc.internal.ModuleImpl.instantiateModuleBuilder(ModuleImpl.java:348)
 at org.apache.tapestry.ioc.internal.ModuleImpl.getModuleBuilder(ModuleImpl.java:273)
 at org.apache.tapestry.ioc.internal.ServiceResourcesImpl.getModuleBuilder(ServiceResourcesImpl.java:106)
 at org.apache.tapestry.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:61)
 at org.apache.tapestry.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:31)
 at org.apache.tapestry.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:49)
 at org.apache.tapestry.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:54)
 at org.apache.tapestry.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
 at org.apache.tapestry.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:61)
 ... 12 more
Caused by: org.springframework.beans.factory.BeanIsAbstractException: Error creating bean with name 'transactionIntercetorTemplate': Bean definition is abstract
 at org.springframework.beans.factory.support.AbstractBeanFactory.checkMergedBeanDefinition(AbstractBeanFactory.java:767)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:220)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
 at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:537)
 at org.apache.tapestry.internal.spring.SpringModuleDef$1.getBean(SpringModuleDef.java:57)
 at org.apache.tapestry.internal.spring.SpringModuleDef$1.getServiceInterface(SpringModuleDef.java:78)
 at org.apache.tapestry.ioc.internal.ModuleImpl.findServiceIdsForInterface(ModuleImpl.java:148)
 at org.apache.tapestry.ioc.internal.RegistryImpl.findServiceIdsForInterface(RegistryImpl.java:470)
 at org.apache.tapestry.ioc.internal.RegistryImpl.getService(RegistryImpl.java:439)
 at org.apache.tapestry.ioc.services.TapestryIOCModule$2.provide(TapestryIOCModule.java:132)
 at $ObjectProvider_1134ceb8123.provide($ObjectProvider_1134ceb8123.java)
 at $ObjectProvider_1134ceb811d.provide($ObjectProvider_1134ceb811d.java)
 at org.apache.tapestry.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:550)
 at org.apache.tapestry.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:557)
 at org.apache.tapestry.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:50)
 at org.apache.tapestry.ioc.internal.util.InternalUtils.calculateParameterValue(InternalUtils.java:217)
 at org.apache.tapestry.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:248)
 at org.apache.tapestry.ioc.internal.ModuleImpl.instantiateModuleBuilder(ModuleImpl.java:327)
 ... 20 more

我想尽量重复利用bean,结果tapestry5报出这样的错误.如果不用的abstract=true的话,用另一种方式配置是OK的.

你可能感兴趣的:(java,spring,bean,IOC,tapestry)