关于HttpInterceptor工具类实现问题
来源:6-7 Http请求前后监听工具-HttpInterceptor开发

慕烨璇凝
2019-12-13
E:\Tools\tomcat\apache-tomcat-7.0.94\apache-tomcat-7.0.94\bin\catalina.bat run
[2019-12-13 12:38:02,302] Artifact permission:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE: "C:\Users\Hasee\.IntelliJIdea2017.3\system\tomcat\Unnamed_permission_4"
Using CATALINA_HOME: "E:\Tools\tomcat\apache-tomcat-7.0.94\apache-tomcat-7.0.94"
Using CATALINA_TMPDIR: "E:\Tools\tomcat\apache-tomcat-7.0.94\apache-tomcat-7.0.94\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_212"
Using CLASSPATH: "E:\Tools\tomcat\apache-tomcat-7.0.94\apache-tomcat-7.0.94\bin\bootstrap.jar;E:\Tools\tomcat\apache-tomcat-7.0.94\apache-tomcat-7.0.94\bin\tomcat-juli.jar"
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/7.0.94
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Apr 10 2019 16:56:40 UTC
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 7.0.94.0
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows 10
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 10.0
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: C:\Program Files\Java\jdk1.8.0_212\jre
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.8.0_212-b10
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Oracle Corporation
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: C:\Users\Hasee\.IntelliJIdea2017.3\system\tomcat\Unnamed_permission_4
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: E:\Tools\tomcat\apache-tomcat-7.0.94\apache-tomcat-7.0.94
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.config.file=C:\Users\Hasee\.IntelliJIdea2017.3\system\tomcat\Unnamed_permission_4\conf\logging.properties
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=UTF-8
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote=
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.port=1099
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.ssl=false
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.rmi.server.hostname=127.0.0.1
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dignore.endorsed.dirs=
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=C:\Users\Hasee\.IntelliJIdea2017.3\system\tomcat\Unnamed_permission_4
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=E:\Tools\tomcat\apache-tomcat-7.0.94\apache-tomcat-7.0.94
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.io.tmpdir=E:\Tools\tomcat\apache-tomcat-7.0.94\apache-tomcat-7.0.94\temp
十二月 13, 2019 12:38: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\jdk1.8.0_212\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;D:\Program Files (x86)\NetSarang\Xftp 6\;D:\Program Files (x86)\NetSarang\Xshell 6\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NGX;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Users\Hasee\AppData\Roaming\nvm;C:\Program Files (x86)\nodejs;C:\Program Files (x86)\Yarn\bin\;D:\Program Files\Git\cmd;C:\Program Files\Java\jdk1.8.0_212\bin;C:\Users\Hasee\AppData\Local\Microsoft\WindowsApps;D:\Program Files\Microsoft VS Code\bin;C:\Users\Hasee\AppData\Roaming\nvm;C:\Program Files (x86)\nodejs;C:\Users\Hasee\AppData\Roaming\npm;D:\Program Files\JetBrains\WebStorm 2018.3.5\bin;;C:\Users\Hasee\AppData\Local\Yarn\bin;D:\Program Files\JetBrains\IntelliJ IDEA 2018.3.5\bin;;.
十二月 13, 2019 12:38:04 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
十二月 13, 2019 12:38:04 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-60636"]
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 504 ms
十二月 13, 2019 12:38:04 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
十二月 13, 2019 12:38:04 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.94
十二月 13, 2019 12:38:04 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
十二月 13, 2019 12:38:04 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-60636"]
十二月 13, 2019 12:38:04 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 39 ms
Connected to server
[2019-12-13 12:38:04,922] Artifact permission:war exploded: Artifact is being deployed, please wait...
十二月 13, 2019 12:38:07 下午 org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
信息: validateJarFile(E:\ProjectWorkspace\JavaEE\IntelliJ IDEA 2017\permission\target\permission-1.0-SNAPSHOT\WEB-INF\lib\tomcat-el-api-8.0.28.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
十二月 13, 2019 12:38:07 下午 org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
信息: validateJarFile(E:\ProjectWorkspace\JavaEE\IntelliJ IDEA 2017\permission\target\permission-1.0-SNAPSHOT\WEB-INF\lib\tomcat-servlet-api-8.0.28.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
十二月 13, 2019 12:38:09 下午 org.apache.catalina.startup.TldConfig execute
信息: 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.
十二月 13, 2019 12:38:09 下午 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext: initialization started
十二月 13, 2019 12:38:09 下午 org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
信息: Refreshing Root WebApplicationContext: startup date [Fri Dec 13 12:38:09 CST 2019]; root of context hierarchy
十二月 13, 2019 12:38:09 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [spring/applicationContext.xml]
Fri Dec 13 12:38:12 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
十二月 13, 2019 12:38:14 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory E:\Tools\tomcat\apache-tomcat-7.0.94\apache-tomcat-7.0.94\webapps\manager
十二月 13, 2019 12:38:14 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory E:\Tools\tomcat\apache-tomcat-7.0.94\apache-tomcat-7.0.94\webapps\manager has finished in 98 ms
Fri Dec 13 12:38:15 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Fri Dec 13 12:38:16 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2019-12-13 12:38:18.087 [RMI TCP Connection(3)-127.0.0.1] INFO com.alibaba.druid.pool.DruidDataSource {dataSource-1} inited
十二月 13, 2019 12:38:18 下午 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext: initialization completed in 8985 ms
[2019-12-13 12:38:18,845] Artifact permission:war exploded: Artifact is deployed successfully
[2019-12-13 12:38:18,845] Artifact permission:war exploded: Deploy took 13,924 milliseconds
十二月 13, 2019 12:38:27 下午 org.springframework.web.servlet.DispatcherServlet initServletBean
信息: FrameworkServlet 'spring': initialization started
十二月 13, 2019 12:38:27 下午 org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
信息: Refreshing WebApplicationContext for namespace 'spring-servlet': startup date [Fri Dec 13 12:38:27 CST 2019]; parent: Root WebApplicationContext
十二月 13, 2019 12:38:27 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-servlet.xml]
十二月 13, 2019 12:38:27 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
信息: Mapped "{[/test/validate.json]}" onto public com.yuluomoshang.common.JsonData com.yuluomoshang.controller.TestController.validate(com.yuluomoshang.param.TestVo)
十二月 13, 2019 12:38:27 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
信息: Mapped "{[/test/hello.page]}" onto public com.yuluomoshang.common.JsonData com.yuluomoshang.controller.TestController.hello()
2019-12-13 12:38:27.671 [http-bio-8080-exec-1] INFO org.hibernate.validator.internal.util.Version HV000001: Hibernate Validator 5.1.3.Final
十二月 13, 2019 12:38:28 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
信息: Looking for @ControllerAdvice: WebApplicationContext for namespace 'spring-servlet': startup date [Fri Dec 13 12:38:27 CST 2019]; parent: Root WebApplicationContext
十二月 13, 2019 12:38:28 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
信息: Looking for @ControllerAdvice: WebApplicationContext for namespace 'spring-servlet': startup date [Fri Dec 13 12:38:27 CST 2019]; parent: Root WebApplicationContext
十二月 13, 2019 12:38:28 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
信息: Looking for @ControllerAdvice: WebApplicationContext for namespace 'spring-servlet': startup date [Fri Dec 13 12:38:27 CST 2019]; parent: Root WebApplicationContext
十二月 13, 2019 12:38:28 下午 org.springframework.web.servlet.DispatcherServlet initServletBean
信息: FrameworkServlet 'spring': initialization completed in 1230 ms
2019-12-13 12:38:28.483 [http-bio-8080-exec-1] INFO com.yuluomoshang.common.SpringExceptionResolver 当前请求是JSON请求
2019-12-13 12:38:28.483 [http-bio-8080-exec-1] WARN com.yuluomoshang.common.SpringExceptionResolver 警告异常
2019-12-13 12:38:28.483 [http-bio-8080-exec-1] ERROR com.yuluomoshang.common.SpringExceptionResolver 这是一个未知JSON请求异常, url: http://localhost:8080/test/validate.jsonexception: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.ExceptionInInitializerError
2019-12-13 12:38:28.581 [http-bio-8080-exec-3] INFO com.yuluomoshang.common.SpringExceptionResolver 当前请求是JSON请求
2019-12-13 12:38:28.582 [http-bio-8080-exec-3] WARN com.yuluomoshang.common.SpringExceptionResolver 警告异常
2019-12-13 12:38:28.582 [http-bio-8080-exec-3] ERROR com.yuluomoshang.common.SpringExceptionResolver 这是一个未知JSON请求异常, url: http://localhost:8080/test/validate.jsonexception: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.yuluomoshang.utils.JsonMapper
十二月 13, 2019 12:38:28 下午 org.springframework.web.servlet.PageNotFound noHandlerFound
警告: No mapping found for HTTP request with URI [/favicon.ico] in DispatcherServlet with name 'spring'
老师,当在spring-servlet.xml中添加下列代码后报错,否则能正常运行
<mvc:interceptors>
<bean class="com.yuluomoshang.common.HttpInterceptor" />
</mvc:interceptors>
因为添加了全局异常处理类,此处显示错误并没有那么详细,
请老师指导一下
写回答
1回答
-
你好,看你的日志,项目正常启动起来了,然后访问一个接口时出错了,出错的内容里显示JsonMapper无法正常使用,你看一下你是不是pom.xml里导入的依赖有问题,你说的这段代码应该是没问题的。
012019-12-14
相似问题