Search code examples
javafreemarkerjboss-eap-6

java.lang.LinkageError: Failed to link freemarker/core/TemplateElement


My problem is that i have an ejb which internally uses freemarker tool to generate a HTML page, built and deployed to JBoss EAP 6.4.10. When i try to access this functionality (which generates HTML code using freemarker tool), jboss throwing below errors:

java.lang.LinkageError: Failed to link freemarker/core/TemplateElement Caused by: java.lang.NoClassDefFoundError: javax/swing/tree/TreeNode

I added freemarker jar in my jboss modules and it's module.xml looks like this:

<module xmlns="urn:jboss:module:1.1" name="org.freemarker">
<resources>
    <resource-root path="freemarker-2.3.25.jar"/>
</resources>

<dependencies>
</dependencies>
</module>

Solution

  • Finally it is found out that the error is due to missing dependency 'javax.api' in freemaker's module.xml file, after adding this dependency in module.xml as below the problem has resolved.

    <module xmlns="urn:jboss:module:1.1" name="org.freemarker">
    <resources>
        <resource-root path="freemarker-2.3.25.jar"/>
    </resources>
    
    <dependencies>
        <module name="javax.api"/>
    </dependencies>