1. 程式人生 > >cannot be resolved to absolute file path because it does not reside in the file system

cannot be resolved to absolute file path because it does not reside in the file system

使用maven分模組元件專案的時候,domain中的實體的*.hbm.xml檔案不能被spring掃描到,因為聚合的時候核心包已經達成jar包了,所以要去jar中去找hbm.xml檔案

<!--注入sessionFactory -->
    <bean id="sessionFactory"  class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="configLocation" value="classpath:hibernate/hibernate.cfg.xml" />
            <!-- 指定對映檔案目錄 -->
            <!--<property name="mappingDirectoryLocations">
                <list>
                    <value>classpath:hibernate</value>
                </list>
            </property>-->
        <property name="mappingJarLocations">
        <list>
            <value>WEB-INF/lib/pro_core-1.0-SNAPSHOT.jar</value>
        </list>
    </property>
    </bean>

更詳細的解釋:

http://www.blogjava.net/jjjachyty/articles/402870.html