NoClassDefFoundError: Could not initialize class freemarker.template.Configuration when configuring custom spring modules in JBoss EAP 6

Solution Verified - Updated -

Issue

Hello, I've setup some modules for Spring. I have an application with a jboss-deployment-structure.xml in an application that has dependencies on spring and freemarker modules, however I'm getting this exception below:

WARN  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-2) FactoryBean threw exception from getObjectType, despite the contract saying that it should return null if the type of its object cannot be determined yet: java.lang.NoClassDefFoundError: Could not initialize class freemarker.template.Configuration
  at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_30]
  at java.lang.Class.forName(Class.java:169) [rt.jar:1.6.0_30]
  at org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean.class$(FreeMarkerConfigurationFactoryBean.java:69) [spring.jar:2.5.6]
  at org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean.getObjectType(FreeMarkerConfigurationFactoryBean.java:69) [spring.jar:2.5.6]
  at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getTypeForFactoryBean(FactoryBeanRegistrySupport.java:55) [spring.jar:2.5.6]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:620) [spring.jar:2.5.6]
  at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:450) [spring.jar:2.5.6]
...

My Spring module looks like this:

<module xmlns="urn:jboss:module:1.1" name="spring" slot="2.5.6">
    <resources>
        <resource-root path="aspectjrt.jar"/>
        <resource-root path="aspectjweaver.jar"/>
        <resource-root path="jaxws-spring-1.8.jar"/>
        <resource-root path="spring.jar"/>
        <resource-root path="xbean-spring-2.7.jar"/>
        <resource-root path="spring-webmvc-2.5.6.jar"/>
    </resources>

    <dependencies>
        <module name="javax.api" export="true"/>
        <module name="javaee.api" export="true"/>
        <module name="org.apache.commons.logging"/>
    </dependencies>
</module>

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 6.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content