本人整合flex3+spring2.5.6+hibernate3.6时,出现了
org.springframework.beans.factory.NoSuchBeanDefinitionException异常
spring配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <!--定义properties环境文件 -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>/WEB-INF/envionment.properties</value>
</property>
</bean> <!-- Bean定义: 配置拦截器 -->
<bean id="authInterceptor" class="com.cn.common.AuthPermission" />
<!-- Bean定义: Flex远程服务类 -->
<bean id="testCmdRemoteService" class="testFacade.testCmdRemoteService" scope="prototype"/>
<bean id="testFlexRemoteService" class="testFacade.testFlexRemoteService" scope="prototype"/>
<!-- Bean定义: hibernate实体Bean -->
<bean id="WlUsr" class="hibernate.model.WlUsr" scope="prototype"/>
<bean id="WlUsrSecurity" class="hibernate.model.WlUsrSecurity" scope="prototype"/>
<!--Bean定义:hibernate DAO -->
<bean id="WlUsrSecurityDAO" class="hibernate.impl.WlUsrSecurityDAOHibernate" autowire="byName"/>
<bean id="WlUsrDAO" class="hibernate.impl.WlUsrDAOHibernate" autowire="byName"/>
<!-- 配置拦截器 (实现权限判断管理功能)-->
<aop:config>
<aop:aspect id="authI" ref="authInterceptor">
<aop:around pointcut="execution (* testFacade.*.*(..))"
method="checkAccess" />
</aop:aspect>
</aop:config>
<!-- 数据源,使用JNDI查找 -->
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>${datasoure_jndi}</value></property>
</bean>
<!-- hibernate的SeesionFactory配置 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- hibernate内hibernate.cfg.xml内配置,由spring托管 -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">false</prop>
</props>
</property>
<!--定义查找Spring托管的hibernate实体类的路径 -->
<property name="packagesToScan">
<list>
<value>hibernate.model</value>
</list>
</property>
</bean> <!-- 事务管理,使用hibernate的SeesionFactory依赖注入 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- DAO组件的事务托管配置 spring 2.x -->
<tx:advice id="txDAO" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="create*" rollback-for="java.lang.Exception"/>
<tx:method name="delete*" rollback-for="java.lang.Exception"/>
<tx:method name="add*" rollback-for="java.lang.Exception"/>
<tx:method name="save*" rollback-for="java.lang.Exception"/>
<tx:method name="delete*" rollback-for="java.lang.Exception"/>
<tx:method name="merge*" rollback-for="java.lang.Exception"/>
<tx:method name="update*" rollback-for="java.lang.Exception"/>
<tx:method name="merge*" rollback-for="java.lang.Exception"/>
<tx:method name="find*" read-only="true" rollback-for="java.lang.Exception"/>
<tx:method name="get*" read-only="true" rollback-for="java.lang.Exception"/>
</tx:attributes>
</tx:advice>
<tx:advice id="txService" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" rollback-for="java.lang.Exception"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor advice-ref="txDAO" pointcut="execution (* hibernate.impl.*.*(..))"/>
<aop:advisor advice-ref="txService" pointcut="execution (* testFacade.*.*(..))"/>
</aop:config>
</beans>
不知这个到底配错了什么,一运行flex RemoteObject的在testFlexRemoteService内的方法,都会报
org.springframework.beans.factory.NoSuchBeanDefinitionException异常,实在搞不懂为什么。
之前发过1个在spring2.5.5下1.x aop配置的问题,无人能给出满意的答复,不知道这个莫名其妙的问题,能否有人能解答。
org.springframework.beans.factory.NoSuchBeanDefinitionException异常
spring配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <!--定义properties环境文件 -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>/WEB-INF/envionment.properties</value>
</property>
</bean> <!-- Bean定义: 配置拦截器 -->
<bean id="authInterceptor" class="com.cn.common.AuthPermission" />
<!-- Bean定义: Flex远程服务类 -->
<bean id="testCmdRemoteService" class="testFacade.testCmdRemoteService" scope="prototype"/>
<bean id="testFlexRemoteService" class="testFacade.testFlexRemoteService" scope="prototype"/>
<!-- Bean定义: hibernate实体Bean -->
<bean id="WlUsr" class="hibernate.model.WlUsr" scope="prototype"/>
<bean id="WlUsrSecurity" class="hibernate.model.WlUsrSecurity" scope="prototype"/>
<!--Bean定义:hibernate DAO -->
<bean id="WlUsrSecurityDAO" class="hibernate.impl.WlUsrSecurityDAOHibernate" autowire="byName"/>
<bean id="WlUsrDAO" class="hibernate.impl.WlUsrDAOHibernate" autowire="byName"/>
<!-- 配置拦截器 (实现权限判断管理功能)-->
<aop:config>
<aop:aspect id="authI" ref="authInterceptor">
<aop:around pointcut="execution (* testFacade.*.*(..))"
method="checkAccess" />
</aop:aspect>
</aop:config>
<!-- 数据源,使用JNDI查找 -->
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>${datasoure_jndi}</value></property>
</bean>
<!-- hibernate的SeesionFactory配置 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- hibernate内hibernate.cfg.xml内配置,由spring托管 -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">false</prop>
</props>
</property>
<!--定义查找Spring托管的hibernate实体类的路径 -->
<property name="packagesToScan">
<list>
<value>hibernate.model</value>
</list>
</property>
</bean> <!-- 事务管理,使用hibernate的SeesionFactory依赖注入 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- DAO组件的事务托管配置 spring 2.x -->
<tx:advice id="txDAO" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="create*" rollback-for="java.lang.Exception"/>
<tx:method name="delete*" rollback-for="java.lang.Exception"/>
<tx:method name="add*" rollback-for="java.lang.Exception"/>
<tx:method name="save*" rollback-for="java.lang.Exception"/>
<tx:method name="delete*" rollback-for="java.lang.Exception"/>
<tx:method name="merge*" rollback-for="java.lang.Exception"/>
<tx:method name="update*" rollback-for="java.lang.Exception"/>
<tx:method name="merge*" rollback-for="java.lang.Exception"/>
<tx:method name="find*" read-only="true" rollback-for="java.lang.Exception"/>
<tx:method name="get*" read-only="true" rollback-for="java.lang.Exception"/>
</tx:attributes>
</tx:advice>
<tx:advice id="txService" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" rollback-for="java.lang.Exception"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor advice-ref="txDAO" pointcut="execution (* hibernate.impl.*.*(..))"/>
<aop:advisor advice-ref="txService" pointcut="execution (* testFacade.*.*(..))"/>
</aop:config>
</beans>
不知这个到底配错了什么,一运行flex RemoteObject的在testFlexRemoteService内的方法,都会报
org.springframework.beans.factory.NoSuchBeanDefinitionException异常,实在搞不懂为什么。
之前发过1个在spring2.5.5下1.x aop配置的问题,无人能给出满意的答复,不知道这个莫名其妙的问题,能否有人能解答。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货