小编KOH*_*IEP的帖子

创建 bean 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#1' 时出错

我正在尝试使用 Maven 和 Intellij Idea 创建一个网络应用程序。安装在 .war 文件中时,测试工作正常。但是当我尝试用 jetty 引用我的休息时,我有很多错误情况:

在 ServletContext 资源 [/WEB-INF/rest-spring.xml] 中定义名称为“org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#1”的 bean 创建时出错:bean 初始化失败;
嵌套异常是 java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException

以下是其余模块文件: Web.xml

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <servlet>
        <servlet-name>restDispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <!--the location of the spring context configuration file-->
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/rest-spring.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>restDispatcherServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)

休息弹簧.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jdbc="http://www.springframework.org/schema/jdbc"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/jdbc
       http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
       http://www.springframework.org/schema/mvc
       http://www.springframework.org/schema/mvc/spring-mvc.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd">


    <mvc:annotation-driven/>

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:model.properties</value>
                <value>classpath:database.properties</value>
                <value>classpath:automobile.properties</value>
            </list>
        </property> …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc maven

5
推荐指数
2
解决办法
3万
查看次数

标签 统计

maven ×1

spring ×1

spring-mvc ×1