Struggle installation with xjetty and mariadb

Hello,

I had it working for almost a weak and suddenly something went wrong.
When I logged in today all german umlaut appeared as a question mark (?).

To complete my personal documentation I uninstalled everything, deleted the database and started over. But now I can not get it work without errors and I’m out of ideas.
I use ubuntu 22.04, installed openjdk-17-jre-headless manually and have a seperated mariadb database cluster running version 11.4.
The database is created with utf8mb4 encoding and the user has all privileges on xwiki.*
I installed xwiki (16.6.0) using the .deb packages: xwiki-xjetty-common and edited the hibernate.cfg.xml to connect to the database.
Now I can run the xwiki setup and install the standard flavor. But when it comes to the installation of the default extentions may errors appear. All of them are like the following and have something to do with translated pages:

Installing document [Home » XWiki » AttachmentSelectorTranslations]
Error: 1366-22007: Incorrect string value: '\x94\xEA\xBE\xB8\xEA\xB8...' for column `xwiki`.`xwikidoc`.`XWD_CONTENT` at row 1
SQL Error: 1366, SQLState: 22007
(conn=116) Incorrect string value: '\x94\xEA\xBE\xB8\xEA\xB8...' for column `xwiki`.`xwikidoc`.`XWD_CONTENT` at row 1
could not execute statement 

At this point I can continue and go to the final wiki, where some things are not shown correctly and translations are not complete. E.G.: the right top corner shows “help.tipsPanel.title” instead of the actual panel.

Can someone give me a hint how to debug this? I have no idea what logfiles could give me the right information. I just do not understand the problem.

This sounds like an encoding problem. Have you created the main wiki database yourself, or was it done by the Debian package (which should be using utf8mb4_bin) ?

Hi,

I created the database by myself:

create database xwiki default character set utf8mb4 collate utf8mb4_bin;
grant all privileges on xwiki.* to 'xwiki'@'%';
flush privileges;

I found somthing in the jetty log, that indicated to hibernate, but i hav no clou where to go next…

2024-08-06 11:36:52,544 [XWiki initialization] INFO  .HibernateDataMigrationManager - Checking Hibernate mapping and updating schema if needed for wiki [xwiki]
2024-08-06 11:36:56,161 [XWiki initialization] INFO  .HibernateDataMigrationManager - Storage schema updates and data migrations are enabled
2024-08-06 11:36:56,280 [XWiki initialization] INFO  .HibernateDataMigrationManager - No data migration to apply for wiki [xwiki] currently in version [160500000]
2024-08-06 11:36:56,281 [XWiki initialization] INFO  .HibernateDataMigrationManager - Checking Hibernate mapping and updating schema if needed for wiki [xwiki]
2024-08-06 11:36:58,964 [XWiki initialization] WARN  o.m.j.m.s.ErrorPacket          - Error: 1366-22007: Incorrect string value: '\xE2\x80\xA6</p...' for column `xwiki`.`xwikidoc`.`XWD_CLASS_XML` at row 1
2024-08-06 11:36:58,965 [XWiki initialization] WARN  o.h.e.j.s.SqlExceptionHelper   - SQL Error: 1366, SQLState: 22007
2024-08-06 11:36:58,965 [XWiki initialization] ERROR o.h.e.j.s.SqlExceptionHelper   - (conn=199) Incorrect string value: '\xE2\x80\xA6</p...' for column `xwiki`.`xwikidoc`.`XWD_CLASS_XML` at row 1
2024-08-06 11:36:58,976 [XWiki initialization] ERROR c.x.x.XWiki                    - Failed to initialize mandatory document [XWiki.EventStream.Code.EventClass]
com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document xwiki:XWiki.EventStream.Code.EventClass

What do you have exactly in the hibernate.cfg.xml file ?

beside the default settings I edited the mariadb part:

<property name="hibernate.connection.url">jdbc:mariadb://10.35.2.58/xwiki?sslMode=trust&amp;serverSslCert=/etc/ssl/self-signed/server-cert.pem</property>
    <property name="hibernate.connection.username">xwiki</property>
    <property name="hibernate.connection.password">XXX</property>
    <property name="hibernate.connection.driver_class">org.mariadb.jdbc.Driver</property>
    <property name="hibernate.dbcp.poolPreparedStatements">true</property>
    <property name="hibernate.dbcp.maxOpenPreparedStatements">20</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="instance.hbm.xml"/>
    <mapping resource="notification-filter-preferences.hbm.xml"/>
    <mapping resource="mailsender.hbm.xml"/>

I don’t see anything in there that could produce such an encoding problem.

I guess you should double-check if the tables indeed do have utf8mb4 as encoding. Something like SHOW FULL COLUMNS FROM xwiki.xwikidoc; for example should tell you if the XWD_CLASS_XML column which is in the error message have the expected collation.

The database server is MariaDB and not MySQL, right ?

MariaDB [xwiki]> SHOW FULL COLUMNS FROM xwiki.xwikidoc;
+------------------------------+---------------+-------------+------+-----+---------+-------+---------------------------------+---------+
| Field                        | Type          | Collation   | Null | Key | Default | Extra | Privileges                      | Comment |
+------------------------------+---------------+-------------+------+-----+---------+-------+---------------------------------+---------+
| XWD_ID                       | bigint(20)    | NULL        | NO   | PRI | NULL    |       | select,insert,update,references |         |
| XWD_FULLNAME                 | varchar(768)  | utf8mb4_bin | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_NAME                     | varchar(768)  | utf8mb4_bin | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_TITLE                    | varchar(768)  | utf8mb4_bin | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_LANGUAGE                 | varchar(5)    | utf8mb4_bin | YES  | MUL | NULL    |       | select,insert,update,references |         |
| XWD_DEFAULT_LANGUAGE         | varchar(5)    | utf8mb4_bin | YES  | MUL | NULL    |       | select,insert,update,references |         |
| XWD_TRANSLATION              | int(11)       | NULL        | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_DATE                     | datetime(6)   | NULL        | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_CONTENT_UPDATE_DATE      | datetime(6)   | NULL        | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_CREATION_DATE            | datetime(6)   | NULL        | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_AUTHOR                   | varchar(768)  | utf8mb4_bin | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_CONTENT_AUTHOR           | varchar(768)  | utf8mb4_bin | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_CREATOR                  | varchar(768)  | utf8mb4_bin | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_WEB                      | varchar(768)  | utf8mb4_bin | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_CONTENT                  | longtext      | utf8mb4_bin | NO   |     | NULL    |       | select,insert,update,references |         |
| XWD_VERSION                  | varchar(255)  | utf8mb4_bin | NO   |     | NULL    |       | select,insert,update,references |         |
| XWD_CUSTOM_CLASS             | varchar(768)  | utf8mb4_bin | NO   |     | NULL    |       | select,insert,update,references |         |
| XWD_PARENT                   | varchar(768)  | utf8mb4_bin | NO   |     | NULL    |       | select,insert,update,references |         |
| XWD_CLASS_XML                | longtext      | utf8mb4_bin | YES  |     | NULL    |       | select,insert,update,references |         |
| XWD_ELEMENTS                 | int(11)       | NULL        | NO   |     | NULL    |       | select,insert,update,references |         |
| XWD_DEFAULT_TEMPLATE         | varchar(768)  | utf8mb4_bin | NO   |     | NULL    |       | select,insert,update,references |         |
| XWD_VALIDATION_SCRIPT        | varchar(768)  | utf8mb4_bin | NO   |     | NULL    |       | select,insert,update,references |         |
| XWD_COMMENT                  | varchar(1023) | utf8mb4_bin | NO   |     | NULL    |       | select,insert,update,references |         |
| XWD_MINOREDIT                | bit(1)        | NULL        | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_SYNTAX_ID                | varchar(50)   | utf8mb4_bin | YES  |     | NULL    |       | select,insert,update,references |         |
| XWD_HIDDEN                   | bit(1)        | NULL        | NO   | MUL | NULL    |       | select,insert,update,references |         |
| XWD_ORIGINAL_METADATA_AUTHOR | varchar(768)  | utf8mb4_bin | YES  | MUL | NULL    |       | select,insert,update,references |         |
+------------------------------+---------------+-------------+------+-----+---------+-------+---------------------------------+---------+

Very strange, I don’t remember ever seeing an encoding problem with utf8mb4, there is not much it does not include (and it’s definitely not stuff you will find in XWiki Standard)…

Strange… now it is working again.

I uninstalled all xwiki packages and dependencies, deleted all inherend files and folder and dropped the database again.
Then I updated all systems and rebooted them.
After that I recreated the database and installed the software packages and configured hibernation.
The only packages that got updated are some ldap libraries and a kernel patch. That should not interfere with xwiki I guess, but what ca I say…
Hope this was a unicorn. Thanks a lot.