Exception when upgrading docker based XWiki from 16 to 17

I’m trying to upgrade XWiki 16.10.15 to 17.10.3 (both postgres-tomcat docker images).

When starting the distribution wizard on step 2 (flavor) I can’t select the new “XWiki Standard Flavor” but get an exception instead:

Failed to execute the [velocity] macro. Cause: [Cannot invoke “org.xwiki.extension.Extension.getId()” because “extension” is null]. Click on this message for details.

The container logs say, XWiki has problems with the old flavor - obviously: I just wanted to upgrade it.

Any ideas on how to solve this issue? See the full exception and logs below.

Thanks, Jim!

Exception:

org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [ #controller()]
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:186)
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:60)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.evaluateBlock(AbstractScriptMacro.java:279)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:182)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:58)
at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:441)
at org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183)
at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.transform(AbstractBlockAsyncRenderer.java:76)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.transform(TemplateAsyncRenderer.java:211)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.renderWiki(TemplateAsyncRenderer.java:152)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:133)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:54)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:284)
at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:284)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:267)
at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.execute(DefaultBlockAsyncRendererExecutor.java:125)
at com.xpn.xwiki.internal.template.InternalTemplateManager.execute(InternalTemplateManager.java:992)
at com.xpn.xwiki.internal.template.InternalTemplateManager.execute(InternalTemplateManager.java:973)
at com.xpn.xwiki.internal.template.InternalTemplateManager.executeNoException(InternalTemplateManager.java:938)
at com.xpn.xwiki.internal.template.DefaultTemplateManager.executeNoException(DefaultTemplateManager.java:187)
at com.xpn.xwiki.internal.template.DefaultTemplateManager.executeNoException(DefaultTemplateManager.java:181)
at org.xwiki.extension.distribution.internal.job.step.AbstractDistributionStep.executeInteractive(AbstractDistributionStep.java:119)
at org.xwiki.extension.distribution.internal.DistributionInternalScriptService.renderCurrentStepToXHTML(DistributionInternalScriptService.java:251)
at org.xwiki.extension.distribution.internal.DistributionInternalScriptService.renderCurrentStepToXHTML(DistributionInternalScriptService.java:237)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:704)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:75)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:242)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:190)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:217)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:190)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:190)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
at org.apache.velocity.Template.merge(Template.java:358)
at org.apache.velocity.Template.merge(Template.java:262)
at org.xwiki.velocity.internal.InternalVelocityEngine.evaluate(InternalVelocityEngine.java:233)
at com.xpn.xwiki.internal.template.VelocityTemplateEvaluator.evaluateContent(VelocityTemplateEvaluator.java:107)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:219)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.renderVelocity(TemplateAsyncRenderer.java:174)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:135)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:54)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:284)
at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:284)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:267)
at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.render(DefaultBlockAsyncRendererExecutor.java:154)
at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:907)
at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:869)
at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:849)
at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:835)
at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:91)
at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:85)
at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2541)
at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:180)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:651)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:339)
at com.xpn.xwiki.web.LegacyActionServlet.service(LegacyActionServlet.java:111)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:138)
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:138)
at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:138)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:138)
at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:66)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:138)
at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:135)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:138)
at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:212)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:138)
at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:120)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:138)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:165)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:88)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:113)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:83)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:654)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:72)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:903)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:973)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:491)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with namespace [environment:/templates/distribution.vm]
at org.xwiki.velocity.internal.InternalVelocityEngine.evaluate(InternalVelocityEngine.java:235)
at org.xwiki.velocity.internal.InternalVelocityEngine.evaluate(InternalVelocityEngine.java:181)
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:177)
… 113 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method ‘getRatingExtension’ in class org.xwiki.extension.script.ExtensionIndexScriptService threw exception java.lang.NullPointerException: Cannot invoke “org.xwiki.extension.Extension.getId()” because “extension” is null at environment:/templates/extension.vm[line 329, column 54]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:308)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:235)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:704)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:75)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:242)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:217)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:217)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.parser.node.ASTElseIfStatement.render(ASTElseIfStatement.java:108)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:190)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:190)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:217)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:171)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.parser.node.ASTElseIfStatement.render(ASTElseIfStatement.java:108)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:190)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:217)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
at org.apache.velocity.Template.merge(Template.java:358)
at org.apache.velocity.Template.merge(Template.java:262)
at org.xwiki.velocity.internal.InternalVelocityEngine.evaluate(InternalVelocityEngine.java:233)
… 115 more
Caused by: java.lang.NullPointerException: Cannot invoke “org.xwiki.extension.Extension.getId()” because “extension” is null
at org.xwiki.extension.script.ExtensionIndexScriptService.getRatingExtension(ExtensionIndexScriptService.java:124)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
… 154 more

logs.txt (32.8 KB)

That nullpointer seems to be more the consequence of some other problem. You don’t have any other warning or error in the log before that ? The warning related to the invalid flavor is expected (as in the UI).

Unfortunately not. I restartet all containers to get a new full log. Besides some memory leak warnings, nothing new, as it seems.

logs2.txt (64.9 KB)

(BTW: Still got the exception after the restart.)

Jim

Cannot initialize plugin [com.xpn.xwiki.plugin.mail.MailPlugin]. This plugin will not be available.

This is not the cause of your problem, but it suggests you have an outdated value in the property xwiki.plugins of the xwiki.cfg file (mainly the fact that the MailPlugin does not exist anymore in XWiki Standard).

The nullpointer seems to suggest it could not resolve the flavor extension, but in that case I would expect to see some error in the log indicating that it could not reach the extension in some repository, or something like this. Unless maybe you disabled all repositories in the xwiki.properties configuration file ?

It’s “easy” to avoid this specific nullpointer by commenting a line in /templates/extension.vm, but you will still be left with an unresolved flavor extension for some reason so it won’t help upgrading it…

I did disable all repositories in xwiki.properties due to we’re running XWiki in an offline environment without internet access.

Here are my config files:

xwiki.cfg

xwiki.encoding=UTF-8
xwiki.section.edit=1
xwiki.section.depth=2
xwiki.backlinks=1
xwiki.tags=1
xwiki.store.migration=1
xwiki.webapppath=
xwiki.inactiveuser.allowedpages=
xwiki.authentication.cookiedomains=
xwiki.authentication.logoutpage=(/|/[^/]+/|/wiki/[^/]+/)logout/*
xwiki.authentication.authclass=org.xwiki.contrib.ldap.XWikiLDAPAuthServiceImpl
xwiki.editcomment=1
xwiki.editcomment.mandatory=0
xwiki.defaultskin=flamingo
xwiki.defaultbaseskin=flamingo
xwiki.plugins=
com.xpn.xwiki.monitor.api.MonitorPlugin,
com.xpn.xwiki.plugin.skinx.JsSkinExtensionPlugin,
com.xpn.xwiki.plugin.skinx.JsSkinFileExtensionPlugin,
com.xpn.xwiki.plugin.skinx.JsResourceSkinExtensionPlugin,
com.xpn.xwiki.plugin.skinx.CssSkinExtensionPlugin,
com.xpn.xwiki.plugin.skinx.CssSkinFileExtensionPlugin,
com.xpn.xwiki.plugin.skinx.CssResourceSkinExtensionPlugin,
com.xpn.xwiki.plugin.skinx.LinkExtensionPlugin,
com.xpn.xwiki.plugin.feed.FeedPlugin,
com.xpn.xwiki.plugin.packaging.PackagePlugin,
com.xpn.xwiki.plugin.fileupload.FileUploadPlugin,
com.xpn.xwiki.plugin.image.ImagePlugin,
com.xpn.xwiki.plugin.rightsmanager.RightsManagerPlugin,
com.xpn.xwiki.plugin.jodatime.JodaTimePlugin,
com.xpn.xwiki.plugin.scheduler.SchedulerPlugin,
com.xpn.xwiki.plugin.mailsender.MailSenderPlugin,
com.xpn.xwiki.plugin.tag.TagPlugin,
com.xpn.xwiki.plugin.zipexplorer.ZipExplorerPlugin
xwiki.plugin.image.cache.capacity=30
xwiki.stats.default=0
xwiki.authentication.ldap=1
xwiki.authentication.ldap.[…]

xwiki.properties

environment.permanentDirectory=/usr/local/xwiki/data
openoffice.autoStart=true
extension.repositories=
extension.oldflavors=org.xwiki.enterprise:xwiki-enterprise-ui-mainwiki
extension.oldflavors=org.xwiki.enterprise:xwiki-enterprise-ui-wiki
extension.oldflavors=org.xwiki.manager:xwiki-manager-ui
extension.oldflavors=org.xwiki.manager:xwiki-manager-wiki-administrator
extension.oldflavors=org.xwiki.manager:xwiki-enterprise-manager-wiki-administrator
extension.oldflavors=com.xpn.xwiki.products:xwiki-enterprise-manager-wiki-administrator
extension.oldflavors=com.xpn.xwiki.products:xwiki-enterprise-wiki
activeinstalls2.pingURL =

BTW: the MailPlugin exception is gone after removing it from xwiki.cfg. :wink:

But did you add the new version of the flavor to your local repository (using the XIP package usually) ? Otherwise, it’s indeed not going to find it, and there is probably some bad error reporting related to this use case in this version.

I was able to reproduce the same error as you (by disabling repositories and not adding the new flavor version in the local repository) and created XWIKI-24029. Will check that today.

I should have… but after double-checking, I haven’t. Thanks a lot, that was the missing hint! I copied the XIP package and now I see the new flavor.

Jim