Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-18181

Errors when hibernate.cfg.xml not at classpath root

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 4.2.0.CR1
    • None
    • hibernate
    • Hide

      Create a Dynamic Web Project and put the Hibernate 4.1.12 jars into /WebContent/WEB-INF/lib. Create hibernate.cfg.xml in, say, /WebContent/META-INF/ (I first saw this with a project that had its hibernate.cfg.xml as a resource stored with classes). Create a Hibernate configuration for the project, selecting Annotations for the type, 4.0 for the Hibernate version, and the path to the configuration file. Click OK, expand the new configuration in the tree, then try to expand Session Factory or Database.

      Show
      Create a Dynamic Web Project and put the Hibernate 4.1.12 jars into /WebContent/WEB-INF/lib. Create hibernate.cfg.xml in, say, /WebContent/META-INF/ (I first saw this with a project that had its hibernate.cfg.xml as a resource stored with classes). Create a Hibernate configuration for the project, selecting Annotations for the type, 4.0 for the Hibernate version, and the path to the configuration file. Click OK, expand the new configuration in the tree, then try to expand Session Factory or Database.

      If a project keeps its hibernate.cfg.xml anywhere besides the root of the classpath, Hibernate Tools will not recognize it. In the Hibernate Configurations tree, expanding either Session Factory or Database gives an error ending in “/hibernate.cfg.xml not found”. (The Configuration subtree appears to work.)

      As a workaround, if I go into the directory holding WEB-INF/classes (i.e. where compiled Java bytecode goes) and symlink hibernate.cfg.xml there, it seems to work.

            kaers@redhat.com Koen Aers
            luke.maurer Luke Maurer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: