Python中文网

一个关于 编程问题的解答网站.

有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java ClassNotFoundException与Freemarker

很抱歉我的问题,但我搞不懂

我有一个在GAE上运行的应用程序,使用Spring MVC,我正在尝试添加Free Marker作为模板语言

在我的pom里。xml,我有:

<dependency>
 <groupId>org.freemarker</groupId>
 <artifactId>freemarker</artifactId>
 <version>2.3.20</version>
</dependency>

此外,在我的dispatcher配置中,我将freemarker视图解析器配置为:

<!-- freemarker config -->
<bean id="freemarkerConfig"
    class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
    <property name="templateLoaderPath" value="/WEB-INF/views/" />
</bean>

<!-- View resolvers can also be configured with ResourceBundles or XML files. 
    If you need different view resolving based on Locale, you have to use the 
    resource bundle resolver. -->
<bean id="viewResolver"
      class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
    <property name="cache" value="true" />
    <property name="prefix" value="" />
    <property name="suffix" value=".ftl" />
</bean>

当我用Eclipse启动Web服务器时,我会得到一个classnotfound异常(见下文),但我无法找出缺少了什么以及如何添加它=(

你能帮帮我吗

谢谢

2013-11-07 17:30:17.097:WARN::Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer] for bean with name 'freemarkerConfig' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]: problem with class file or dependent class; nested exception is 
java.lang.NoClassDefFoundError: org/springframework/ui/freemarker/FreeMarkerConfigurationFactory|Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer] for bean with name 'freemarkerConfig' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/ui/freemarker/FreeMarkerConfigurationFactory:
java.lang.ClassNotFoundException: org.springframework.ui.freemarker.FreeMarkerConfigurationFactory

共 (0) 个答案