我敢扶老奶奶 2021-04-13 16:04 采纳率: 100%
浏览 1673
已采纳

报错[http-nio-8080-exec-6]

我新添加了一个billcontroller后发现好像mvc无法识别报错,其他页面访问正常,百度了很多,注解和web配置都是没错的呀,新添加的这个注解什么的都加了,没有问题
查询数据库也可查出来,真得不知道是哪里有问题,在线等。。。。
具体错误:点订单管理报错404.其他功能正常

控制台报错:

报错


 

controller层

web.xml
 

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Archetype Created Web Application</display-name>
  <!--乱码过滤器-->
  <filter>
    <filter-name>encode</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>encode</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <!--MVC配置文件-->
  <servlet>
    <servlet-name>mvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:spring-*.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>mvc</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
</web-app>

spring-mvc.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:content="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/context
        http://www.springframework.org/schema/context/spring-context.xsd
         http://www.springframework.org/schema/mvc
         http://www.springframework.org/schema/mvc/spring-mvc.xsd">
    <content:component-scan base-package="cn.smbms"/>
    <!--转换器 解决返回对象时候 乱码 和 日期样式-->
    <!--<bean class="org.springframework.context.support.ConversionServiceFactoryBean" id="conversionService2">
        <property name="converters">
            <bean class="cn.smbms.converts.StringToDateConvert" id="stringToDateConvert"/>
        </property>
    </bean>-->
    <!--conversion-service=""-->
    <mvc:annotation-driven>
        <mvc:message-converters>
            <!--配置消息转换器-->
            <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                <property name="supportedMediaTypes">
                    <list>
                        <value>application/json;charset=UTF-8</value>
                    </list>
                </property>
            </bean>
            <!--时间戳-->
            <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"
                  id="fastJsonHttpMessageConverter">
                <property name="supportedMediaTypes">
                    <list>
                        <value>application/json;charset=UTF-8</value>
                        <value>text/html;charset=UTF-8</value>
                    </list>
                </property>
                <property name="features">
                    <list>
                        <value>WriteDateUseDateFormat</value>
                    </list>
                </property>
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>
    <bean class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean" id="bean">
        <property name="favorParameter" value="true"/>
        <property name="mediaTypes">
            <props>
                <prop key="html">text/html;charset=UTF-8</prop>
                <prop key="json">application/json;charset=UTF-8</prop>
                <prop key="xml">application/xml;charset=UTF-8</prop>
            </props>
        </property>
    </bean>
    <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver" id="negotiatingViewResolver">
        <property name="contentNegotiationManager" ref="bean"/>
        <property name="viewResolvers">
            <list>
                <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
                    <property name="prefix" value="/WEB-INF/jsp/"/>
                    <property name="suffix" value=".jsp"/>
                </bean>
            </list>
        </property>
    </bean>
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" id="viewResolver">
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
    <mvc:resources mapping="/css/**" location="/css/"/>
    <mvc:resources mapping="/images/**" location="/images/"/>
    <mvc:resources mapping="/js/**" location="/js/"/>
    <mvc:resources mapping="/calendar/**" location="/calendar/"/>
    <!--全局异常处理-->
    <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
        <property name="exceptionMappings">
            <props>
                <prop key="java.lang.RuntimeException">error</prop>
            </props>
        </property>
    </bean>
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="maxUploadSize" value="5000000"/>
        <property name="defaultEncoding" value="UTF-8"/>
    </bean>
    <!--拦截器-->
    <mvc:interceptors>
        <mvc:interceptor>
            <!--拦截的请求-->
            <mvc:mapping path="/**"/>
            <!--排除的请求-->
            <mvc:exclude-mapping path="/"/>
            <mvc:exclude-mapping path="/login.do"/>
            <mvc:exclude-mapping path="/images/**"/>
            <mvc:exclude-mapping path="/js/**"/>
            <mvc:exclude-mapping path="/css/**"/>
            <mvc:exclude-mapping path="/calendar/**"/>

            <bean class="cn.smbms.intercept.Sysintercept" id="sysintercept"/>
        </mvc:interceptor>
    </mvc:interceptors>
    
</beans>


 

  • 写回答

6条回答 默认 最新

  • 关注

    相对路径的问题,请采纳,谢谢!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失