每当我添加ContentNegotiatingViewResolver bean时,我所有其他jsp页面都会停止工作

时间:2015-08-20 12:17:03

标签: spring-mvc

每当我添加ContentNegotiatingViewResolver bean时,我的所有其他jsp页面都停止工作,我收到此错误 - HTTP状态500 - servlet fitTrackerServlet的Servlet.init()抛出异常

org.springframework.beans.factory.BeanCreationException:使用名称' org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0'创建bean时出错。在ServletContext资源[/WEB-INF/config/servlet-config.xml]中定义:bean的初始化失败;嵌套异常是java.lang.NoClassDefFoundError:com / fasterxml / jackson / core / JsonGenerator

这是我的servlet-config.xml

<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" p:order="0"/>


<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
    <property name="order" value="1"/>
    <property name="contentNegotiationManager">
        <bean class="org.springframework.web.accept.ContentNegotiationManager">
            <constructor-arg>
                <bean class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy">
                    <constructor-arg>
                        <map>
                            <entry key="json" value="application/json"/>
                            <entry key="xml" value="application/xml"/>
                        </map>
                    </constructor-arg>
                </bean>
            </constructor-arg>
        </bean>
    </property>

    <property name="defaultViews">
        <list>
            <bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"/>
            <bean class="org.springframework.web.servlet.view.xml.MarshallingView">
                <constructor-arg>
                    <bean class="org.springframework.oxm.xstream.XStreamMarshaller">
                        <property name="autodetectAnnotations" value="true"/> 
                    </bean>
                </constructor-arg>
            </bean>         
        </list>
    </property>
</bean> 

0 个答案:

没有答案