Failing to Initalize XWikiAllGroup

Hello,

We have an outstanding issue where new users are not being added to XWikiAllGroup when created. When I start up the server I am seeing the below error stack trace when XWiki is initializing. Is this the reason I am unable to add new users to XWikiAllGroup ?

2024-05-02 18:11:10,474 [XWiki initialization] ERROR c.x.x.XWiki                    - Failed to initialize mandatory document [XWiki.XWikiAllGroup] 
com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document xwiki:XWiki.XWikiAllGroup
	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:751)
	at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:255)
	at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:215)
	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:2108)
	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:2003)
	at com.xpn.xwiki.XWiki.initializeMandatoryDocument(XWiki.java:1462)
	at com.xpn.xwiki.XWiki.initializeMandatoryDocuments(XWiki.java:1426)
	at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1354)
	at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1291)
	at com.xpn.xwiki.XWiki.<init>(XWiki.java:1264)
	at com.xpn.xwiki.internal.XWikiInitializerJob.runInternal(XWikiInitializerJob.java:103)
	at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:246)
	at org.xwiki.job.AbstractJob.run(AbstractJob.java:223)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: javax.persistence.PersistenceException: org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1
	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1411)
	at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:489)
	at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3303)
	at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2438)
	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:449)
	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:183)
	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$300(JdbcResourceLocalTransactionCoordinatorImpl.java:40)
	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:281)
	at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101)
	at com.xpn.xwiki.internal.store.hibernate.HibernateStore.endTransaction(HibernateStore.java:940)
	at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:602)
	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:731)
	... 13 common frames omitted
Caused by: org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1
	at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:78)
	at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:54)
	at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:47)
	at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3571)
	at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3438)
	at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3870)
	at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:202)
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
	at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478)
	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475)
	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:344)
	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40)
	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1407)
	... 24 common frames omitted

Hello, what version of XWiki? What database and what version of it?

Could you provide more logs from the beginning of the XWiki start until this error you’ve pasted?

Thx

Hi @vmassol.

Thanks for the reply

We are on XWiki 15.10.2 and using PostgreSQL version 12.2

Here is the server log from start to this error and other errors. But these errors are not stopping the XWIki from being initialized.

Attached my local server startup logs.

logFile.txt (32.5 KB)

Hi @vmassol

Did you get a chance to look over that log file?

Looking for some suggestions here.

Thanks,
Anurag Suri

Yes I checked the log file but I don’t know what the problem is.

What I would do if I were you:

Thx