3 Replies Latest reply on Apr 30, 2012 5:04 AM by dgeraskov

    Error configuring Hibernate console

    cbaumgartner

      I'm trying to use the Hibernate Console for Eclipse.

       

      I'm getting a rather long error message that starts with:

       

      Error while opening console configuration

      Reason: org.hibernate.console.HibernateConsuleRuntimeException: Could not load AnnotationConfiguration.

       

      It looks like the cause is:

       

      org.hibernate.MappingException: Invalid ORM mapping file.

      Error parsing XML (line5 : column 30): schema_reference.4: Failed to read schema document 'orm_2_0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

      Error parsing XML (line5 : column 30): cvc-elt.1: Cannot find the declaration of element 'entity-mappings'.

       

      (many similar lines deleted...)

       

        at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:920)

                at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:107)

                at org.hibernate.cfg.Configuration.addResource(Configuration.java:668)

                at org.hibernate.cfg.AnnotationConfiguration.addResource(AnnotationConfiguration.java:1134)

                at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:719)

                at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1647)

                at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1626)

                at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1224)

                at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:107)

                at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1600)

                at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1212)

                at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:107)

                at org.hibernate.cfg.Configuration.configure(Configuration.java:1554)

                at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1206)

                at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:107)

                at org.hibernate.console.ConfigurationFactory.loadConfigurationXML(ConfigurationFactory.java:347)

                at org.hibernate.console.ConfigurationFactory.configureStandardConfiguration(ConfigurationFactory.java:276)

                at org.hibernate.console.ConfigurationFactory.buildConfiguration(ConfigurationFactory.java:162)

                at org.hibernate.console.ConfigurationFactory.createConfiguration(ConfigurationFactory.java:94)

                at org.hibernate.console.ConsoleConfiguration$3.execute(ConsoleConfiguration.java:213)

                at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)

                at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:72)

                at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:210)

                at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:166)

                at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:40)

                at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:100)

                at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)

                at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)

                at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

       

      The start of my mapping file looks like:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"

                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"

                     version="1.0">

       

      Any ideas on what is causing this?

       

      Thanks.

        • 1. Error configuring Hibernate console
          dgeraskov

          Why the error say "orm_2_0.xsd" but in file you have "orm_1_0.xsd"? Do you have more orm files? Do you use orm1 in jpa 2.0 project?

          • 2. Re: Error configuring Hibernate console
            wan

            I got the exact error as you:

            Failed to read schema document 'orm_2_0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

             

            I searched for the key word, and this page is the only one referring this error.

            It turned out that it is caused by jar conflict. For my case, there are both hibernate3 and hibernate 4 on classpath. Hope it helps.

            • 3. Re: Error configuring Hibernate console
              dgeraskov

              Probaly you mixed jpa2_0 and jpa1_0 xml mappings? For example in persistence.xml you have 1.0 version but in orm.xml 2.0 or vice versa?