NoSuchMethodException: com.xpn.xwiki.XWiki.getNotificationManager()

when I try to install any extension, in the jobs log window I can always see this error

com.xpn.xwiki.XWiki.getNotificationManager()
class java.lang.NoSuchMethodException: com.xpn.xwiki.XWiki.getNotificationManager()
    at java.lang.Class.getMethod(Class.java:1786)
    at org.xwiki.legacy.internal.oldcore.notification.LegacyNotificationDispatcher.getNotificationManager(LegacyNotificationDispatcher.java:94)
    at org.xwiki.legacy.internal.oldcore.notification.LegacyNotificationDispatcher.onEvent(LegacyNotificationDispatcher.java:109)
    at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:320)
    at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:285)
    at com.xpn.xwiki.XWiki.beforeSave(XWiki.java:1977)
    at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:2032)
    at org.xwiki.extension.xar.internal.handler.packager.DocumentMergeImporter.saveDocumentSetContextUser(DocumentMergeImporter.java:207)
    at org.xwiki.extension.xar.internal.handler.packager.DocumentMergeImporter.saveDocument(DocumentMergeImporter.java:153)
    at org.xwiki.extension.xar.internal.handler.packager.DocumentMergeImporter.importDocument(DocumentMergeImporter.java:116)
    at org.xwiki.extension.xar.internal.handler.packager.Packager.importDocumentToWiki(Packager.java:230)
    at org.xwiki.extension.xar.internal.handler.packager.Packager.importXARToWiki(Packager.java:184)
    at org.xwiki.extension.xar.internal.handler.packager.Packager.importXARToWiki(Packager.java:157)
    at org.xwiki.extension.xar.internal.handler.packager.Packager.importXAR(Packager.java:148)
    at org.xwiki.extension.xar.internal.handler.XarExtensionHandler.installInternal(XarExtensionHandler.java:201)
    at org.xwiki.extension.xar.internal.handler.XarExtensionHandler.install(XarExtensionHandler.java:166)
    at org.xwiki.extension.handler.internal.DefaultExtensionHandlerManager.install(DefaultExtensionHandlerManager.java:85)
    at org.xwiki.extension.job.internal.AbstractExtensionJob.installExtension(AbstractExtensionJob.java:306)
    at org.xwiki.extension.job.internal.AbstractExtensionJob.applyAction(AbstractExtensionJob.java:209)
    at org.xwiki.extension.job.internal.AbstractExtensionJob.applyActions(AbstractExtensionJob.java:157)
    at org.xwiki.extension.job.internal.InstallJob.runInternal(InstallJob.java:154)
    at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:242)
    at org.xwiki.job.AbstractJob.run(AbstractJob.java:219)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

(extension then installs and works fine)

In catalina.out there is lot of errors like this

May 17 10:26:31 pgdenik.cz tomcat9[278596]: java.lang.NoSuchMethodException: com.xpn.xwiki.XWiki.getNotificationManager()

Any idea what it can be?

It’s a very strange error since both XWiki.getNotificationManager and LegacyNotificationDispatcher.getNotificationManager (which is what seems to call it in your case) comes from the same xwiki-platform-legacy-oldcore JAR. This suggests that you might have both xwiki-platform-legacy-oldcore (where the LegacyNotificationDispatcher class is found) and xwiki-platform-oldcore (where the XWiki class is found) JAR in your <xwiki>/WEB-INF/lib/ folder.

1 Like

wow, that was exactly it. I was recently updating xwiki-platform-legacy-oldcore.jar file and accidentally left xwiki-platform-oldcore.jar in the /lib/ directory.

Thank you!