Topic: 帮我看看我的 (SPRING)applicationContext.xml配置有错误吗?

  Print this page

1.帮我看看我的 (SPRING)applicationContext.xml配置有错误吗? Copy to clipboard
Posted by: 奶油
Posted on: 2006-07-30 08:48

帮我看看我的 applicationContext.xml配置有错误吗?
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- Choose the dialect that matches your "dataSource" definition -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/lyb</value><!--?seUnicode=true&characterEncoding=utf8-->
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value></value>
</property>
</bean>
<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<list>
<value>numb1/table/lyb.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- 测试成功后删掉试试 -->
<bean id="myTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
<!-- AOP DAO Intecepter -->
<bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
<property name="sessionFactory">
<ref bean="mySessionFactory"/>
</property>
</bean>
<!-- 上面为测试部分 -->
<bean id="hLybDao" class="numb1.dao.hibernate.HLybDao">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
</beans>

2.Re:帮我看看我的 (SPRING)applicationContext.xml配置有错误吗? [Re: 奶油] Copy to clipboard
Posted by: 奶油
Posted on: 2006-07-30 08:49

运行SPRING后老是报下列错误
javax.servlet.ServletException: Error creating bean with name 'mySessionFactory' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Could not parse mapping document in input stream

非常感谢!

3.Re:帮我看看我的 (SPRING)applicationContext.xml配置有错误吗? [Re: 奶油] Copy to clipboard
Posted by: kingmain
Posted on: 2006-07-31 08:52

<ref local="dataSource"/>应该是<ref bean="dataSource"/>吧

4.Re:帮我看看我的 (SPRING)applicationContext.xml配置有错误吗? [Re: 奶油] Copy to clipboard
Posted by: hitaco
Posted on: 2006-08-07 13:03

ref local是对的

error在别的地方


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923