配置文件:
?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/cq/bean/SysUser.hbm.xml</value>
</list>
</property>
</bean>
<!-- 数据源 -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="url" value="jdbc:oracle:thin:@192.168.0.101:1521:chen"/>
        <property name="username" value="wfm"/>
        <property name="password" value="wfm"/>        
        <property name="maxActive" value="100"/>
        <property name="maxIdle" value="30"/>
        <property name="maxWait" value="1000"/>
        <property name="defaultAutoCommit" value="true"/>
        <property name="removeAbandoned" value="true"/>
        <property name="removeAbandonedTimeout" value="60"/>
    </bean>
    <!-- 服务代理-事务管理 -->
    <bean id="sysUserService"  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    <property name="proxyInterfaces">
    <list>
    <value>com.springinaction.training.service.CourseService<!-- 代理实现接口 -->
    </value>
    </list>
    </property>
    <property name="target">
    <ref bean="sysUserTarget"/><!-- 被代理的对象 -->
    </property>
    <property name="transactionAttributes">
<props>
<prop key="find*">
PROPAGATION_REQUIRED,readOnly,-OrderException
</prop>
<!--<prop key="save*">
PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException
</prop>
--></props>
</property>
    </bean>
    <bean id="sysUserTarget" class="com.cq.BO.Impl.SysUserImpl"/>
 
</beans>

解决方案 »

  1.   

    配置文件:
    ?xml version="1.0" encoding="UTF-8"?>
    <beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>com/cq/bean/SysUser.hbm.xml</value>
    </list>
    </property>
    </bean>
    <!-- 数据源 -->
        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
            <property name="url" value="jdbc:oracle:thin:@192.168.0.101:1521:chen"/>
            <property name="username" value="wfm"/>
            <property name="password" value="wfm"/>        
            <property name="maxActive" value="100"/>
            <property name="maxIdle" value="30"/>
            <property name="maxWait" value="1000"/>
            <property name="defaultAutoCommit" value="true"/>
            <property name="removeAbandoned" value="true"/>
            <property name="removeAbandonedTimeout" value="60"/>
        </bean>
        <!-- 服务代理-事务管理 -->
        <bean id="sysUserService"  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="proxyInterfaces">
        <list>
        <value>com.springinaction.training.service.CourseService<!-- 代理实现接口 -->
        </value>
        </list>
        </property>
        <property name="target">
        <ref bean="sysUserTarget"/><!-- 被代理的对象 -->
        </property>
        <property name="transactionAttributes">
    <props>
    <prop key="find*">
    PROPAGATION_REQUIRED,readOnly,-OrderException
    </prop>
    <!--<prop key="save*">
    PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException
    </prop>
    --></props>
    </property>
        </bean>
        <bean id="sysUserTarget" class="com.cq.BO.Impl.SysUserImpl"/>
     
    </beans>
      

  2.   

    配置文件:
    ?xml version="1.0" encoding="UTF-8"?>
    <beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>com/cq/bean/SysUser.hbm.xml</value>
    </list>
    </property>
    </bean>
    <!-- 数据源 -->
        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
            <property name="url" value="jdbc:oracle:thin:@192.168.0.101:1521:chen"/>
            <property name="username" value="wfm"/>
            <property name="password" value="wfm"/>        
            <property name="maxActive" value="100"/>
            <property name="maxIdle" value="30"/>
            <property name="maxWait" value="1000"/>
            <property name="defaultAutoCommit" value="true"/>
            <property name="removeAbandoned" value="true"/>
            <property name="removeAbandonedTimeout" value="60"/>
        </bean>
        <!-- 服务代理-事务管理 -->
        <bean id="sysUserService"  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="proxyInterfaces">
        <list>
        <value>com.springinaction.training.service.CourseService<!-- 代理实现接口 -->
        </value>
        </list>
        </property>
        <property name="target">
        <ref bean="sysUserTarget"/><!-- 被代理的对象 -->
        </property>
        <property name="transactionAttributes">
    <props>
    <prop key="find*">
    PROPAGATION_REQUIRED,readOnly,-OrderException
    </prop>
    <!--<prop key="save*">
    PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException
    </prop>
    --></props>
    </property>
        </bean>
        <bean id="sysUserTarget" class="com.cq.BO.Impl.SysUserImpl"/>
     
    </beans>
      

  3.   

    首先遇到这样配置文件错误的问题说明 仔细读一下 打印出来的异常信息.然后根据里面的特定关键字如(Error creating bean with name 'sessionFactory' ) 直接顺着这个点慢慢的修改/调试 就这样一次次的多调上几次.. 你就有经验了.. 也明白原理性的代码结构..  这可以说是个人能力比较好的煅炼方式..
      

  4.   

    你的配置文件里面没有用到Spring里面的SessionFactory  
      

  5.   

    那这样呢??还是一样的错
    <?xml version="1.0" encoding="UTF-8"?>
    <beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>com/cq/bean/SysUser.hbm.xml</value>
    </list>
    </property>
    </bean>
    <!-- 数据源 -->
        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
            <property name="url" value="jdbc:oracle:thin:@192.168.0.101:1521:chen"/>
            <property name="username" value="wfm"/>
            <property name="password" value="wfm"/>        
            <property name="maxActive" value="100"/>
            <property name="maxIdle" value="30"/>
            <property name="maxWait" value="1000"/>
            <property name="defaultAutoCommit" value="true"/>
            <property name="removeAbandoned" value="true"/>
            <property name="removeAbandonedTimeout" value="60"/>
        </bean>
        <!-- 服务代理-事务管理 -->
        <bean id="sysUserService"  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"><!--
        <property name="proxyInterfaces">
        <list>
        <value>com.springinaction.training.service.CourseService 代理实现接口 
        </value>
        </list>
        </property>-->
        <property name="transactionManager">
    <ref bean="transactionManager" />
    </property>
        <property name="target">
        <ref bean="sysUserTarget"/><!-- 被代理的对象 -->
        </property>
        <property name="transactionAttributes">
    <props>
    <prop key="find*">
    PROPAGATION_REQUIRED,readOnly,-OrderException
    </prop>
    <!--<prop key="save*">
    PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException
    </prop>
    --></props>
    </property>
        </bean>
        <bean id="sysUserTarget" class="com.cq.BO.Impl.SysUserImpl"/>
      <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"/>
       </bean>
    </beans>
      

  6.   

    看看你的SysUser.hbm.xml 映射文件在没看的基础,猜测中
    <key-property name="XXX" type="string">
        <column name="XXXX" length="32" />
    </key-property>
    对应的类型不能是(java.lang.String)
      

  7.   

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- 
        Mapping file autogenerated by MyEclipse Persistence Tools
    -->
    <hibernate-mapping>
        <class name="com.cq.bean.SysUser" table="SYS_USER" schema="WFM">
            <id name="userCode" type="java.lang.Long">
                <column name="USER_CODE" scale="0" />
                <generator class="assigned" />
            </id>
            <property name="userAccount" type="java.lang.String">
                <column name="USER_ACCOUNT" length="50" />
            </property>
            <property name="userPwd" type="java.lang.String">
                <column name="USER_PWD" length="100" />
            </property>
            <property name="userName" type="java.lang.String">
                <column name="USER_NAME" length="100" />
            </property>
            <property name="userMemo" type="java.lang.String">
                <column name="USER_MEMO" length="1000" />
            </property>
            <property name="userFlag" type="java.lang.Long">
                <column name="USER_FLAG" precision="22" scale="0" />
            </property>
            <property name="userSortId" type="java.lang.Long">
                <column name="USER_SORT_ID" precision="22" scale="0" />
            </property>
            <property name="userType" type="java.lang.String">
                <column name="USER_TYPE" length="1" />
            </property>
            <property name="userMaster" type="java.lang.String">
                <column name="USER_MASTER" length="50" />
            </property>
        </class>
    </hibernate-mapping>
      

  8.   

    type="java.lang.String" 改 type="string"
    type="java.lang.Long" 改 type="long"
      

  9.   

    为什么啊 ??这个文件是有myeclispe工具生成的。
      

  10.   

    我经常使用myeclispe,我成生的却是type="string"
      

  11.   

    问题解决 !!把lib下的asm2.2.3.jar删除就可以了 。
    不知道为什么??