title: Failed to create sessionFactory object.org.hibernate.MappingException: invalid configuration
body: <p>Why do I get "Failed to create sessionFactory object.org.hibernate.MappingException: invalid configuration" when I try to execute the main? I'm using Hibernate 4.2.11.Final with a PostGreSQL DB. This is my hibernate.cfg.xml:</p>
  
  <pre><code>    &lt;?xml version='1.0' encoding='utf-8'?&gt;
      &lt;!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  
      &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQLDialect&lt;/property&gt;
          &lt;property name="hibernate.connection.driver_class"&gt;org.postgresql.Driver&lt;/property&gt;
          &lt;property name="hibernate.connection.username"&gt;postgres&lt;/property&gt;
          &lt;property name="hibernate.connection.password"&gt;postgres&lt;/property&gt;
          &lt;property name="hibernate.connection.url"&gt;jdbc:postgresql://localhost:5432/ProgettoPersonaleDB&lt;/property&gt;
          &lt;property name="connection_pool_size"&gt;1&lt;/property&gt;
          &lt;property name="hbm2ddl.auto"&gt;create&lt;/property&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
          &lt;property name="hibernate.current_session_context_class"&gt;thread&lt;/property&gt;
  
          &lt;!-- Drop and re-create the database schema on startup --&gt;
          &lt;property name="hbm2ddl.auto"&gt;update&lt;/property&gt;
          &lt;!-- &lt;mapping class="org.javabrains.sanjaya.dto.UserDetails" /&gt; --&gt;
          &lt;mapping resource="Players.hbm.xml" /&gt;
          &lt;mapping resource="Users.hbm.xml" /&gt;
          &lt;!-- &lt;mapping class="ProgettoPersonale.src.main.java.ProgettoPersonale.ProgettoPersonale.Users.java"/&gt; --&gt;
          &lt;mapping
              class="ProgettoPersonale/src/main/java/ProgettoPersonale/ProgettoPersonale/Users.java" /&gt;
          /
          &lt;mapping
              class="ProgettoPersonale/src/main/java/ProgettoPersonale/ProgettoPersonale/Players" /&gt;
  
  
          &lt;class-cache class="org.hibernate.auction.Item" usage="read-write"/&gt;
          &lt;class-cache class="org.hibernate.auction.Bid" usage="read-only"/&gt;
          &lt;collection-cache collection="org.hibernate.auction.Item.bids" usage="read-write"/&gt;
  
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>And this is the full stack-trace, thank you!</p>
  
  <pre><code>    02:02:35.149 [main] DEBUG o.h.i.util.xml.DTDEntityResolver - Located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
  Failed to create sessionFactory object.org.hibernate.MappingException: invalid configuration
  Exception in thread "main" java.lang.ExceptionInInitializerError
      at ProgettoPersonale.ProgettoPersonale.ManagePlayers.addPlayer(ManagePlayers.java:27)
      at ProgettoPersonale.ProgettoPersonale.PlayersMain.main(PlayersMain.java:23)
  Caused by: org.hibernate.MappingException: invalid configuration
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2098)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:2015)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:1994)
      at ProgettoPersonale.ProgettoPersonale.ManagePlayers.addPlayer(ManagePlayers.java:21)
      ... 1 more
  Caused by: org.xml.sax.SAXParseException; lineNumber: 36; columnNumber: 20; Il contenuto del tipo di elemento "session-factory" deve corrispondere a "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)".
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
      at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:1994)
      at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:879)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
      at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
      at org.dom4j.io.SAXReader.read(SAXReader.java:465)
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2095)
      ... 4 more
  </code></pre>