I'm having trouble in running an add-on in Confluence 5.9. This seems to be related to a pom.xml configuration but after several combinations I haven't been able to figure out exactly what should change in order to build it with the right dependencies.
Does anyone have a clue on how to resolve this?
The stacktrace is as follows:
java.lang.RuntimeException: Error rendering template for decorator root at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:183) caused by: java.lang.RuntimeException: Error rendering template for decorator page at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:183) caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'xxx' in class com.xxx.xxx.VelocityBridge threw exception com.google.common.util.concurrent.ExecutionError: java.lang.LinkageError: loader constraint violation: when resolving method "com.atlassian.confluence.setup.webwork.ConfluenceVelocityManager.getConfluenceVelocityContext()Lorg/apache/velocity/context/Context;" the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) of the current class, com/xxx/xxx/settings/ThemeSettings, and the class loader (instance of org/apache/catalina/loader/WebappClassLoader) for the method's defining class, com/atlassian/confluence/setup/webwork/ConfluenceVelocityManager, have different Class objects for the type org/apache/velocity/context/Context used in the signature at xxx/decorators/page.vmd[line 17, column 46] at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:351)
Community moderators have prevented the ability to post new answers.
Fixed by adding the following to the pom.xml:
<Import-Package> org.apache.velocity.context;version="[${velocity.osgi.bound.version},${velocity.osgi.bound.version}]", *;resolution:=optional </Import-Package> <velocity.osgi.bound.version>1.6.4.atlassian_9</velocity.osgi.bound.version>
Thanks, helped me!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I also had a very similar issue with using VelocityContext with Confluence 5.9. What helped is to use a plain map instead which I got by Map<String, Object> velocityContext = MacroUtils.defaultVelocityContext(); instead of using the VelocityContext class itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It breaks on the following call: Context velocityContext = ConfluenceVelocityManager.getConfluenceVelocityContext();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is an addon you created? Is it multipart maven project? Are you importing the correct api in the pom with scope provided? Share part of code that you think it is breaking. Other wise the error might fall in this category https://confluence.atlassian.com/display/CONFKB/'java.lang.RuntimeException+Error+rendering+template+for+decorator+root'+in+a+Page
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.