Tomcat常見異常及解決方案程式碼例項
公司專案,開發語言為java,中介軟體為Tomcat,執行過程中,從Tomcat出現了一些異常,現將異常及解決辦法記錄如下,僅供參考。(不斷在補充中.......)
異常一:
1、日誌內容
org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
at org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine(AbstractNioInputBuffer.java:233)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1017)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
2、解決辦法
在tomcat安裝資料夾的 conf/catalina.properties 中最後新增一行:
org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
異常二:
1、日誌內容
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 |
com.alibaba.druid.stat.DruidStatService]unregister mbean error
javax.management.InstanceNotFoundException: com.alibaba.druid:type=DruidStatService
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(DefaultMBeanServerInterceptor.java:427)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(DefaultMBeanServerInterceptor.java:415)
at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(JmxMBeanServer.java:546)
at com.alibaba.druid.stat.DruidStatService.unregisterMBean(DruidStatService.java:374)
at com.alibaba.druid.stat.DruidDataSourceStatManager.removeDataSource(DruidDataSourceStatManager.java:202)
at com.alibaba.druid.pool.DruidDataSource$2.run(DruidDataSource.java:1479)
at java.security.AccessController.doPrivileged(Native Method)
at com.alibaba.druid.pool.DruidDataSource.unregisterMbean(DruidDataSource.java:1475)
at com.alibaba.druid.pool.DruidDataSource.close(DruidDataSource.java:1434)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:354)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:277)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:972)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:979)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1006)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:982)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:934)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:583)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4900)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5537)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745) |
2、解決辦法
修改tomcat的bin目錄下的catalina.sh件,在# OS specific support. $var _must_ be set to either true or false.與cygwin=false之間加上JAVA_OPTS="-Ddruid.registerToSysProperty=true"
異常三:
1、日誌內容
1
2
3
4
5
6
7
8
9
10
11
12 |
INFO [http-nio-80-exec-16] org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character foundinmethod name. HTTP method names must be tokens
at org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine(AbstractNioInputBuffer.java:236)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1065)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745) |
2、解決辦法
修改tomcat安裝資料夾的 conf/server.xml,在 <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" maxHttpHeaderSize ="10240" redirectPort="8443" />中,maxHttpHeaderSize的預設值是8*1024,你只需要調成你需要的值就好了。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69957453/viewspace-2764041/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS 常見異常及解決辦法CentOS
- Java常見異常及解釋Java
- 常見問題及解決方案
- Java 常見異常及趣味解釋Java
- WordPress:常見問題及解決方案
- javaWeb常見異常的解決方法JavaWeb
- 快取常見問題及解決方案快取
- Hadoop常見錯誤及解決方案Hadoop
- Kafka常見的問題及解決方案Kafka
- 開發常見錯誤及解決方案
- Ionic異常及解決
- Redis快取的主要異常及解決方案Redis快取
- 爬蟲常見錯誤程式碼及解決措施爬蟲
- native程式異常crash定位解決方案
- Spring10種常見異常解決方法Spring
- 常見問題及解決
- 【知識分享】伺服器常見異常問題及解決辦法伺服器
- 物聯網路卡常見問題及解決方案
- CrashSight 接入上報常見問題及解決方案
- 【FAQ】推送服務常見問題及解決方案
- 爬蟲專案常見問題及解決方案爬蟲
- MySQL資料庫常見錯誤及解決方案MySql資料庫
- iPhone 6/Plus常見使用問題及解決方案iPhone
- Q9使用常見問題及解決方案
- CSS常見佈局解決方案CSS
- 網站流量異常變動的8種常見原因及解決建議網站
- Git:程式碼衝突常見解決方法Git
- Web程式設計師常見的5個錯誤及解決方案Web程式設計師
- [持續更新]hive異常解決方案Hive
- Git常見問題及解決Git
- SAP質量管理模組常見問題及解決方案
- Android應用安全常見問題及解決方案Android
- 軟體專案管理常見問題及解決方案專案管理
- Flex常見佈局例項Flex
- 常見的跨域解決方案(全)跨域
- 前端常見跨域解決方案(全)前端跨域
- git 常見問題的解決方案Git
- 常見的高可用MySQL解決方案MySql