Tomcat常见异常及解决方案代码实例

Tomcat常见异常及解决方案代码实例,第1张

Tomcat常见异常及解决方案代码实例

本文主要介绍Tomcat常见异常及解决方案代码示例,通过示例代码介绍的非常详细,对大家的学习或工作有一定的参考价值,有需要的朋友可以参考一下。

公司的开发语言是java,中间件是Tomcat。在 *** 作过程中,Tomcat出现了一些异常。异常情况及解决方法记录如下,仅供参考。(不断补充......)

异常1:

1.日志内容

org.Apache.coyote.http11.abstractHttp11processor.process解析HTTP请求头时出错
注意:以后出现的HTTP头解析错误将在调试级别记录。
Java.lang.illegalargumentexception:在方法名中发现无效字符。HTTP方法名必须是org.Apache.coyote.HTTP11.abstractnioinputbuffer.parserequestline(abstractnioinputbuffer.Java:233)

2.解决办法

在tomcat安装文件夹的conf/catalina.properties中添加最后一行:

org.Apache.Tomcat.util.buf.udecoder.allow_ENCODED_SLASH=true

异常2:

1.日志内容

com.alibaba.druid.stat.DruidStatService]unregistermbeanerror javax.management.InstanceNotFoundException:com.alibaba.druid:type=DruidStatService atcom.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095) atcom.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(DefaultMBeanServerInterceptor.java:427) atcom.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(DefaultMBeanServerInterceptor.java:415) atcom.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(JmxMBeanServer.java:546) atcom.alibaba.druid.stat.DruidStatService.unregisterMBean(DruidStatService.java:374) atcom.alibaba.druid.stat.DruidDataSourceStatManager.removeDataSource(DruidDataSourceStatManager.java:202) atcom.alibaba.druid.pool.DruidDataSource$2.run(DruidDataSource.java:1479) atjava.security.AccessController.doPrivileged(NativeMethod) atcom.alibaba.druid.pool.DruidDataSource.unregisterMbean(DruidDataSource.java:1475) atcom.alibaba.druid.pool.DruidDataSource.close(DruidDataSource.java:1434) atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod) atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) atjava.lang.reflect.Method.invoke(Method.java:606) atorg.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:354) atorg.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:277) atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) atorg.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:972) atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) atorg.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:979) atorg.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1006) atorg.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:982) atorg.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:934) atorg.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:583) atorg.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116) atorg.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4900) atorg.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5537) atorg.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221) atorg.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424) atorg.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1413) atjava.util.concurrent.FutureTask.run(FutureTask.java:262) atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) atjava.lang.Thread.run(Thread.java:745)

2.解决办法

修改tomcat的bin目录中的catalina.sh文件,并在#osspecificsupport之间添加Java_opts="-DDRuid.registertosysproperty=true"。$var_must_设置为true或false。而cygwin=false。

异常3:

1.日志内容

INFO[http-nio-80-exec-16]org.apache.coyote.http11.AbstractHttp11Processor.processErrorparsingHTTPrequestheader Note:furtheroccurrencesofHTTPheaderparsingerrorswillbeloggedatDEBUGlevel. java.lang.IllegalArgumentException:Invalidcharacterfoundinmethodname.HTTPmethodnamesmustbetokens atorg.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine(AbstractNioInputBuffer.java:236) atorg.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1065) atorg.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684) atorg.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539) atorg.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495) atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) atorg.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) atjava.lang.Thread.run(Thread.java:745)

2.解决办法

在中修改tomcat安装文件夹的conf/server.xml

就是本文的全部内容。希望对大家的学习有帮助,支持我们。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/774549.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-03
下一篇 2022-05-03

发表评论

登录后才能评论

评论列表(0条)

保存