在整合spring、hibernate时,mapping映射文件出现does not denote a directory错误。
错误日志:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Mapping directory location [file [F:\workspace\hr\HrSystem\bin\com\zhueli\soft\hr\entity\HrAccount.hbm.xml]] does not denote a directory
配置文件applicationContext.xml
[code="java"]<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
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.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:dbinit.properties</value>
</list>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
${hibernate.dialect}
</prop>
<prop key="hibernate.show_sql">
${hibernate.show_sql}
</prop>
<prop key="hibernate.cache.use_query_cache">
${hibernate.cache.use_query_cache}
</prop>
<prop key="hibernate.cache.provider_class">
${hibernate.cache.provider_class}
</prop>
</props>
</property>
<property name="mappingDirectoryLocations">
<list>
<value>
classpath*:/com/zhueli/soft/hr/entity/*.hbm.xml
</value>
</list>
</property>
<property name="lobHandler" ref="lobHandler" />
</bean>
<bean id="lobHandler" lazy-init="true"
class="org.springframework.jdbc.support.lob.DefaultLobHandler" />
<aop:config>
<aop:advisor
pointcut="execution(* com.zhueli.soft.hr.service.*.*(..))"
advice-ref="txAdvice" />
<aop:advisor
pointcut="execution(* com.zhueli.soft.hr.*.*.service.*.*(..))"
advice-ref="txAdvice" />
<aop:advisor
pointcut="execution(* com.zhueli.soft.hr.*.service.*.*(..))"
advice-ref="txAdvice" />
<aop:advisor
pointcut="execution(* com.zhueli.soft.hr.*.*.*.service.*.*(..))"
advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="insert*" />
<tx:method name="save*" />
<tx:method name="create*" />
<tx:method name="add*" />
<tx:method name="update*" />
<tx:method name="modify*" />
<tx:method name="delete*" />
<tx:method name="remove*" />
<tx:method name="send*" />
<tx:method name="do*" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>
<bean id="baseDao" class="com.zhueli.soft.hr.db.BaseDaoImpl">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<import resource="classpath:dataAccessContext-local.xml" />
[/code]
经检查项目不存在中文,实体类目录也确实生成了。