Announcement Announcement Module
Collapse
No announcement yet.
FNFE on Hibernate Files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • FNFE on Hibernate Files

    I am getting a FileNotFoundException on Hibernate files and am stumped as to why. I have looked at the petclinic and other apps/sample code and everything looks right. My applicationContext.xml snippet is:

    <property name="mappingResources">
    <list>
    <value>
    Program.hbm.xml
    </value>
    </list>
    </property>

    The Program.hbm.xml file is at WEB-INF/classes/Program.hbm.xml

    When I start up JBoss I get:

    Initialization of bean failed; nested exception is java.io.FileNotFoundException: Could not open class path resource [
    Program.hbm.xml
    ]

    What am I missing here?

    Thanks,

    Bryan

  • #2
    Bryan, which version of Spring and Hibernate are you using ? Have you tried to run the petclinic sample out-of-the-box ?
    It works fine with Spring 1.1.3 and hibernate 2.1.7 (on Tomcat).

    I also tried to put the name of the mapping file on a new line, like you did (alarmed by the newlines in your exception message), but it still worked.

    Maybe an older version of spring handles newlines in the xml differently ? I know there has been a problem with comments and CDATA inside values.
    http://opensource.atlassian.com/proj...browse/SPR-205

    Maarten

    Comment


    • #3
      Thanks for your reply Marteen. I am using Spring 1.1.3 and Hibernate 2.1.7. I had copied the code out of a running application so I didn't try to run the petclinic on my configuration yet. I am starting to do that right now.

      I am deploying on JBoss 3.2.4, jdk 1.2.4_05 on Windows XP.

      Comment


      • #4
        Bryan,
        remove the newlines / spaces before and after the file name:
        Code:
        <property name="mappingResources"> 
          <list> 
            <value>Program.hbm.xml</value> 
          </list> 
        </property>
        HTH

        Comment


        • #5
          Omar,

          Any idea why it works for me (with the newlines) but not for Bryane ?
          Platform issue maybe ? I only tried it on Windows.

          Maarten

          Comment

          Working...
          X