Announcement Announcement Module
Collapse
No announcement yet.
Application context : mapping resources Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Application context : mapping resources

    I'm a newbie in spring and I would like to know if is is possible to define mapping ressource in a folder which is different from WEB-INF/classes

    this is my applicationContext file

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">


    Code:
    <beans default-lazy-init="false" default-dependency-check="none" default-autowire="no">
      <!-- ========================= Start of PERSISTENCE DEFINITIONS ========================= -->
      <!-- Choose the dialect that matches your "dataSource" definition -->
      <bean id="sessionFactory" name="trung" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
        <property name="mappingResources">
          <list>
            <value>artware/core/model/UserPreference.hbm.xml</value>
            <value>artware/core/model/Application.hbm.xml</value>
            <value>artware/core/model/ApplicationRight.hbm.xml</value>
            <value>artware/core/model/Menu.hbm.xml</value>
            <value>artware/core/model/UserGroup.hbm.xml</value>
            <value>artware/core/model/MenuOption.hbm.xml</value>
            <value>artware/core/model/UserAccount.hbm.xml</value>
          <value>/plugin/framework/artware/framework/model/component/Action.hbm.xml</value>
          </list>
        </property>
        <property name="hibernateProperties">
          <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
            <prop key="hibernate.show_sql">false</prop>
            <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
            <prop key="hibernate.proxool.xml">../proxool.xml</prop>
            <prop key="hibernate.proxool.pool_alias">spring</prop>
          </props>
        </property>
      </bean>
      <!-- Transaction manager for a single Hibernate SessionFactory &#40;alternative to JTA&#41; -->
      <bean id="myTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
        <property name="sessionFactory">
          <ref local="sessionFactory" />
        </property>
      </bean>
      <!-- interceptor-->
      <bean name="openSessionInViewInterceptor" class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
        <property name="sessionFactory">
          <ref local="sessionFactory" />
        </property>
      </bean>
      <!-- -->
      <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
        <property name="sessionFactory">
          <ref local="sessionFactory" />
        </property>
      </bean>
    the problem arrive when Spring map the Action.hbm.xml file
    -->java.io.FileNotFoundException: class path resource

    the first file are in myApplication/WEB-INF/classes/ ..... folder (no problems)

    and the action.hbm.file is in myApplication/plugin/plugin1/WEB-INF/classes

    can you help me ??

  • #2
    there should not "/" at the begining of your filepath, and question is make sure plugin/framework/artware/framework/model/component/Action.hbm.xml

    is under classpath of your project,

    Comment

    Working...
    X