Hi Douglas,

> On 6 Jan 2017, at 20:49, Douglas Landau <dougl...@westmarine.com> wrote:
> 
> Greetings,
> 
> Another one of these.  A Java stacktrace looking very very much like the one 
> reported Aug 10 2016 by Tom Neumann on the Forum, 
> http://dev.xwiki.org/xwiki/bin/view/Community/Forum
> 
> However, his error was at line 233 of hibernate.cfg.xml, whereas mine is at 
> line 244:
> 
> Caused by: org.xml.sax.SAXParseException; lineNumber: 244; columnNumber: 21; 
> The content of element type "session-factory" must match 
> "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)”.

This means that you’ve modified hibernate.cfg.xml but you’re added elements at 
the wrong place in the XML, not following the DTD at 
http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd.

> The thing is, the file is only 245 lines long.  I don't see the error.  I 
> have commented out the hsqldb section at line 90.  I have uncommented the 
> MySQL section by moving the closing comment from line 138 to line 124.
> 
> Can anyone see what I've done wrong?  Many thanks-

> 
> #cat hibernate.cfg.xml
> <?xml version="1.0" encoding="UTF-8”?

[snip]

>    <!-- Configuration for the default database.
>         Comment out this section and uncomment other sections below if you 
> want to use another database.
>         Note that the database tables will be created automatically if they 
> don't already exist.
> 
>         If you want the main wiki database to be different than "xwiki" (or 
> the default schema for schema based engines)
>         you will also have to set the property xwiki.db in xwiki.cfg file
>    -->
> 
> <!--  Commented out by DKL, 1/3/2017
> 
>    <property 
> name="connection.url">jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true</property>
>    <property name="connection.username">sa</property>
>    <property name="connection.password"></property>
>    <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
>    <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
> 
>    <property name="hibernate.connection.charSet">UTF-8</property>
>    <property name="hibernate.connection.useUnicode">true</property>
>    <property name="hibernate.connection.characterEncoding">utf8</property>
> 
>    <property name="connection.url">jdbc:mysql://localhost/xwiki</property>
>    <property name="connection.username">xwiki</property>
>    <property name="connection.password">xwiki</property>
>    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
>    <property 
> name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
> 
>    <property name="hibernate.connection.charSet">UTF-8</property>
>    <property name="hibernate.connection.useUnicode">true</property>
>    <property name="hibernate.connection.characterEncoding">utf8</property>
> -->
> 
>    <mapping resource="xwiki.hbm.xml"/>
>    <mapping resource="feeds.hbm.xml"/>
>    <mapping resource="activitystream.hbm.xml"/>
>    <mapping resource="instance.hbm.xml"/>
>    <mapping resource="mailsender.hbm.xml”/>

I think that'd the error is here and those mappings need to be commented out 
too since they’re defined in the mysql section but you made them be out of 
order and come before properties…

"(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)”.

Means that property elements must come before mapping elements in the XML 
file...

Thanks
-Vincent

PS: Note that this is not specifically related to XWiki but more to Hibernate.

>    <!-- MySQL configuration.
>         Uncomment if you want to use MySQL and comment out other database 
> configurations.
>         Notes:
>           - if you want the main wiki database to be different than "xwiki"
>             you will also have to set the property xwiki.db in xwiki.cfg file
>    -->
> 
>    <property 
> name="connection.url">jdbc:mysql://localhost/xwiki?useSSL=false</property>
>    <property name="connection.username">xwiki</property>
>    <property name="connection.password">xwiki</property>
>    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
>    <property 
> name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
>    <property name="dbcp.poolPreparedStatements">true</property>
>    <property name="dbcp.maxOpenPreparedStatements">20</property>
>    <mapping resource="xwiki.hbm.xml"/>
>    <mapping resource="feeds.hbm.xml"/>
>    <mapping resource="activitystream.hbm.xml"/>
>    <mapping resource="instance.hbm.xml"/>
>    <mapping resource="mailsender.hbm.xml"/>
> 
>    <!-- HSQLDB configuration.
>         Uncomment if you want to use HSQLDB and comment out other database 
> configurations.
>         Notes:
>           - if you want the main wiki schema to be different than "PUBLIC" 
> (the default HSQLDB schema)
>             you will also have to set the property xwiki.db in xwiki.cfg file
> 
>    <property 
> name="connection.url">jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true</property>
>    <property name="connection.username">sa</property>
>    <property name="connection.password"></property>
>    <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
>    <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
>    <mapping resource="xwiki.hbm.xml"/>
>    <mapping resource="feeds.hbm.xml"/>
>    <mapping resource="activitystream.hbm.xml"/>
>    <mapping resource="instance.hbm.xml"/>
>    <mapping resource="mailsender.hbm.xml"/>
>    -->
> 
>    <!-- PostgreSQL configuration.
>         Uncomment if you want to use PostgreSQL and comment out other 
> database configurations.
>         Notes:
>           - "jdbc.use_streams_for_binary" needs to be set to "false",
>             see https://community.jboss.org/wiki/HibernateCoreMigrationGuide36
>           - "xwiki.virtual_mode" can be set to either "schema" or "database". 
> Note that currently the database mode
>             doesn't support database creation (see 
> http://jira.xwiki.org/browse/XWIKI-8753)
>           - if you want the main wiki database to be different than "xwiki" 
> (or "public" in schema mode)
>             you will also have to set the property xwiki.db in xwiki.cfg file
> 
>    <property name="connection.url">jdbc:postgresql:xwiki</property>
>    <property name="connection.username">xwiki</property>
>    <property name="connection.password">xwiki</property>
>    <property name="connection.driver_class">org.postgresql.Driver</property>
>    <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
>    <property name="jdbc.use_streams_for_binary">false</property>
>    <property name="xwiki.virtual_mode">schema</property>
>    <mapping resource="xwiki.postgresql.hbm.xml"/>
>    <mapping resource="feeds.hbm.xml"/>
>    <mapping resource="activitystream.hbm.xml"/>
>    <mapping resource="instance.hbm.xml"/>
>    <mapping resource="mailsender.hbm.xml"/>
>    -->
> 
>    <!-- Oracle configuration.
>         Uncomment if you want to use Oracle and comment out other database 
> configurations.
>         Notes:
>           - the 2 properties named "connection.SetBigStringTryClob" and
>             "jdbc.batch_size" are required to tell Oracle to allow CLOBs 
> larger than 32K.
>           - "jdbc.use_streams_for_binary" needs to be set to "false",
>             see https://community.jboss.org/wiki/HibernateCoreMigrationGuide36
>           - if you want the main wiki schema to be different than "xwiki"
>             you will also have to set the property xwiki.db in xwiki.cfg file
> 
>    <property 
> name="connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
>    <property name="connection.username">xwiki</property>
>    <property name="connection.password">xwiki</property>
>    <property 
> name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
>    <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
>    <property name="connection.SetBigStringTryClob">true</property>
>    <property name="jdbc.batch_size">0</property>
>    <property name="jdbc.use_streams_for_binary">false</property>
>    <property name="dbcp.poolPreparedStatements">true</property>
>    <property name="dbcp.maxOpenPreparedStatements">20</property>
>    <mapping resource="xwiki.oracle.hbm.xml"/>
>    <mapping resource="feeds.oracle.hbm.xml"/>
>    <mapping resource="activitystream.hbm.xml"/>
>    <mapping resource="instance.hbm.xml"/>
>    <mapping resource="mailsender.oracle.hbm.xml"/>
>    -->
> 
>    <!-- Derby configuration.
>         Uncomment if you want to use Derby and comment out other database 
> configurations.
>         Notes:
>           - if you want the main wiki schema to be different than "APP" (the 
> default Derby schema)
>             you will also have to set the property xwiki.db in xwiki.cfg file
> 
>    <property 
> name="connection.url">jdbc:derby:/some/path/xwikidb;create=true</property>
>    <property 
> name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
>    <property name="dialect">org.hibernate.dialect.DerbyDialect</property>
>    <property name="dbcp.poolPreparedStatements">true</property>
>    <property name="dbcp.maxOpenPreparedStatements">20</property>
>    <mapping resource="xwiki.derby.hbm.xml"/>
>    <mapping resource="feeds.hbm.xml"/>
>    <mapping resource="activitystream.hbm.xml"/>
>    <mapping resource="instance.hbm.xml"/>
>    <mapping resource="mailsender.hbm.xml"/>
>    -->
> 
>    <!-- H2 configuration.
>         Uncomment if you want to use H2 and comment out other database 
> configurations.
>         Notes:
>           - if you want the main wiki schema to be different than "PUBLIC" 
> (the default H2 schema)
>             you will also have to set the property xwiki.db in xwiki.cfg file
> 
>    <property 
> name="connection.url">jdbc:h2:${environment.permanentDirectory}/database/xwiki</property>
>    <property name="connection.username">sa</property>
>    <property name="connection.password"></property>
>    <property name="connection.driver_class">org.h2.Driver</property>
>    <property name="dialect">org.hibernate.dialect.H2Dialect</property>
>    <mapping resource="xwiki.hbm.xml"/>
>    <mapping resource="feeds.hbm.xml"/>
>    <mapping resource="activitystream.hbm.xml"/>
>    <mapping resource="instance.hbm.xml"/>
>    <mapping resource="mailsender.hbm.xml"/>
>    -->
> 
>  </session-factory>
> </hibernate-configuration>
> 

Reply via email to