开发者社区> 问答> 正文

弄了半天,始终找不出哪里出错了,求指点? 400 报错

弄了半天,始终找不出哪里出错了,求指点? 400 报错

Tomcat 报错如下

十月 04, 2016 12:10:04 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:mvcdemo' did not find a matching property.
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version:        Apache Tomcat/9.0.0.M9
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built:          Jul 4 2016 18:22:47 UTC
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number:         9.0.0.0
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name:               Windows 10
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version:            10.0
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture:          amd64
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home:             C:\Program Files\Java\jre1.8.0_101
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version:           1.8.0_101-b13
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor:            Oracle Corporation
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE:         E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME:         E:\apache-tomcat-9.0.0.M9
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=E:\apache-tomcat-9.0.0.M9
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=E:\apache-tomcat-9.0.0.M9\endorsed
十月 04, 2016 12:10:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=GBK
十月 04, 2016 12:10:04 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_101\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_101/bin/server;C:/Program Files/Java/jre1.8.0_101/bin;C:/Program Files/Java/jre1.8.0_101/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\ ;D:\apache-maven-3.3.9\bin;;C:\WINDOWS\System32;;.
十月 04, 2016 12:10:05 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-nio-8080"]
十月 04, 2016 12:10:05 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
十月 04, 2016 12:10:05 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-nio-8009"]
十月 04, 2016 12:10:05 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
十月 04, 2016 12:10:05 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1291 ms
十月 04, 2016 12:10:05 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
十月 04, 2016 12:10:05 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/9.0.0.M9
十月 04, 2016 12:10:06 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
十月 04, 2016 12:10:06 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
log4j:WARN No appenders could be found for logger (org.springframework.web.servlet.DispatcherServlet).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
十月 04, 2016 12:10:07 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring FrameworkServlet 'mvcDispatcher'
十月 04, 2016 12:10:08 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler [http-nio-8080]
十月 04, 2016 12:10:08 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler [ajp-nio-8009]
十月 04, 2016 12:10:08 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 3305 ms
十月 04, 2016 12:10:31 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [mvcDispatcher] in context with path [/mvcdemo] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config] with root cause
java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.Config
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1274)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1108)
	at org.springframework.web.servlet.support.JstlUtils.exposeLocalizationContext(JstlUtils.java:101)
	at org.springframework.web.servlet.view.JstlView.exposeHelpers(JstlView.java:135)
	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1257)
	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)


pom.xml如下

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.uu</groupId>
  <artifactId>mvcdemo</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>mvcdemo Maven Webapp</name>
  <url>http://maven.apache.org</url>
  
  <properties>
      <commons-lang.version>2.6</commons-lang.version>
      <slf4j.version>1.7.21</slf4j.version>
      <spring.version>4.3.0.RELEASE</spring.version>
  </properties>
  
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>
        
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>${commons-lang.version}</version>
    </dependency>
    
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j.version}</version>
        <exclusions>
            <exclusion>
                <artifactId>slf4j-api</artifactId>
                <groupId>org.slf4j</groupId>
            </exclusion>
        </exclusions> 
        </dependency>
        
        <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
  </dependencies>
  
  <build>
    <finalName>mvcdemo</finalName>
  </build>
</project>



mvcDispatcher-servlet如下
<?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:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context.xsd
         http://www.springframework.org/schema/aop
         http://www.springframework.org/schema/aop/spring-aop.xsd
         http://www.springframework.org/schema/mvc
         http://www.springframework.org/schema/mvc/spring-mvc.xsd
         http://www.springframework.org/schema/tx
         http://www.springframework.org/schema/tx/spring-tx.xsd">
    <context:annotation-config/>
        <context:component-scan base-package="com.uu">
            <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
        </context:component-scan>
        
        <mvc:annotation-driven/>
    
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
        <property name="prefix" value="/WEB-INF/jsps/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
    

</beans>




展开
收起
爱吃鱼的程序员 2020-05-30 22:45:51 1626 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    看重点错误:


    严重: Servlet.service()forservlet [mvcDispatcher] in context with path [/mvcdemo] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config] with root cause
    java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.Config

    把jstl标签库坐标引入即可:

    https://mvnrepository.com/artifact/jstl/jstl

    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    ######同意楼上
    2020-05-30 22:45:52
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Android插件化-从入门到"放弃" 立即下载
代码未写,漏洞已出——谈谈设计不当导致的安全问题 立即下载
低代码开发师(初级)实战教程 立即下载