Announcement Announcement Module
Collapse
No announcement yet.
Hibernate in Tomcat 5.5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate in Tomcat 5.5

    I am migrating from JBoss 4.01.sp1 to Tomcat 5.5. In JBoss, the following Hibernate mapping works fine:

    <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean" singleton="true">

    <property name="dataSource"><ref bean="dataSource"/></property>

    <property name="mappingResources">
    <list>
    <value>WEB-INF/classes/sainc/dao/hbm/JbpUsers.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarAttachment.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarProject.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarProjectType.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarProjectPhase.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarElement.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarElementType.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarMimeType.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarAttribute.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarAttributeSet.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarAttributeValueSet.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarAttributeValue.hbm.xml</value>
    <value>WEB-INF/classes/sainc/dao/hbm/StarAttributeDataType.hbm.xml</value>
    </list>
    </property>

    When using Tomcat 5.5, however, I'm receviing the following error:

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/star-data.xml]: Initialization of bean failed; nested exception is java.io.FileNotFoundException: class path resource [WEB-INF/classes/sainc/dao/hbm/JbpUsers.hbm.xml] cannot be opened because it does not exist
    java.io.FileNotFoundException: class path resource [WEB-INF/classes/sainc/dao/hbm/JbpUsers.hbm.xml] cannot be opened because it does not exist

    Does anybody have any ideas as to why this would be happening? Is there a workaround?

    Thanks!

  • #2
    Does anybody have any ideas as to why this would be happening?
    Is your WAR expanded - this will occur if it's not.

    Is there a workaround?
    Try
    Code:
    <property name="mappingLocations">
      <value>classpath*&#58;/sainc/dao/hbm/*.hbm.xml</value>
    </property>

    Comment


    • #3
      Got it!

      Well, I got it to work starting at com/.../...htm.xml under the "WEB-INF/classes" directory. Now that I think about it, I wonder how it worked the other way. ???

      Cheers...


      <property name="mappingResources">
      <list>
      <value>/com/sainc/dao/hbm/JbpUsers.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarAttachment.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarProject.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarProjectType.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarProjectPhase.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarElement.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarElementType.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarMimeType.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarAttribute.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarAttributeSet.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarAttributeValueSet.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarAttributeValue.hbm.xml</value>
      <value>/com/sainc/dao/hbm/StarAttributeDataType.hbm.xml</value>
      </list>
      </property>

      Comment

      Working...
      X