java 代码
今天想集成tapestry5,spring ,hibernate,jdbc.缺遇到了一个奇怪的问题.现在我把spring的配置XML帖一下
xml 代码
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
- "http://www.springframework.org/dtd/spring-beans.dtd">
-
- <beans>
-
- <bean id="transactionIntercetorTemplate" abstract="true">
- <property name="transactionAttributes">
- <props>
- <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
- <prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
- <prop key="check*">PROPAGATION_REQUIRED,readOnly</prop>
- <prop key="insert*">PROPAGATION_REQUIRED, -Exception</prop>
- <prop key="update*">PROPAGATION_REQUIRED, -Exception</prop>
- <prop key="delete*">PROPAGATION_REQUIRED, -Exception</prop>
- <prop key="save*">PROPAGATION_REQUIRED, -Exception</prop>
- <prop key="*">PROPAGATION_REQUIRED, -Exception</prop>
- </props>
- </property>
- </bean>
-
-
- <bean id="hibernateTransactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor" parent="transactionIntercetorTemplate">
- <property name="transactionManager">
- <bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
- <property name="sessionFactory">
- <ref bean="sessionFactory" />
- </property>
- </bean>
- </property>
- </bean>
-
-
- <bean id="jdbcTransactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor" parent="transactionIntercetorTemplate">
- <property name="transactionManager">
- <bean id="jdbcTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource">
- <ref bean="dataSource" />
- </property>
- </bean>
- </property>
- </bean>
-
-
- <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
- <property name="interceptorNames">
- <list>
- <idref bean="hibernateTransactionInterceptor" />
- <idref bean="jdbcTransactionInterceptor" />
- </list>
- </property>
-
- <property name="beanNames">
- <list>
-
- <idref bean="userService"/>
-
- </list>
- </property>
- </bean>
-
-
- <bean id="hibernateDaoTemplate" abstract="true">
- <property name="sessionFactory">
- <ref bean="sessionFactory" />
- </property>
- </bean>
-
-
- <bean id="jdbcDaoTemplate" abstract="true">
- <property name="dataSource">
- <ref bean="dataSource" />
- </property>
- </bean>
- </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的.