Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

LinkageError: loader constraint violation: when resolving method "com.atlassian.confluence.setup.webwork.ConfluenceVelocityManager.getConfluenceVelocityContext()"

Ricardo Martins November 25, 2015

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)

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Ricardo Martins November 26, 2015

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>
Rina Nir (AC)
Solutions Partner
Solution Partners provide consulting, sales, and technical services on Atlassian products.
February 22, 2016

Thanks, helped me!

2 votes
Mibex_Software
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2015

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.

Radko October 23, 2017

This did the trick for me. Thank you!

0 votes
Ricardo Martins November 25, 2015

It breaks on the following call: Context velocityContext = ConfluenceVelocityManager.getConfluenceVelocityContext();

0 votes
Panos
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2015

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events