2019独角兽企业重金招聘Python工程师标准>>>
最近遇到现网漏洞检测的问题,tomcat扫描到一个漏洞,漏洞内容为:Apache Tomcat examples 目录可访问导致多个漏洞。
针对这个漏洞,分析决定,将tomcat/webapps文件夹内容全部删除,仅留下本身开发的代码包。操作步骤:
1、直接删除tomcat/webapps文件夹里面内容。删除后直接启动tomcat包以下错误:
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base C:\Users\luoairong\Desktop\apache-tomcat-6.0.47-aose\webapps\host-manager does not ex
ist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.
java:142)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardConte
xt.java:4390)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
563)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:803)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:78
0)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.ja
va:676)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.j
ava:602)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:503
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:325)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1069)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463
)
at org.apache.catalina.core.StandardService.start(StandardService.java:5
25)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:759
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
2017-2-17 17:56:24 org.apache.catalina.core.StandardContext start
严重: Error in resourceStart()
2017-2-17 17:56:24 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2017-2-17 17:56:24 org.apache.catalina.core.StandardContext start
严重: Context [/host-manager] startup failed due to previous errors
2017-2-17 17:56:24 org.apache.catalina.core.StandardContext stop
信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
host-manager] has not been started
2017-2-17 17:56:24 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
2017-2-17 17:56:24 org.apache.catalina.core.StandardContext resourcesStart
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base C:\Users\luoairong\Desktop\apache-tomcat-6.0.47-aose\webapps\manager does not exist o
r is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.
java:142)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardConte
xt.java:4390)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
563)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:803)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:78
0)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.ja
va:676)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.j
ava:602)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:503
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:325)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1069)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463
)
at org.apache.catalina.core.StandardService.start(StandardService.java:5
25)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:759
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
2017-2-17 17:56:24 org.apache.catalina.core.StandardContext start
严重: Error in resourceStart()
2017-2-17 17:56:24 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2017-2-17 17:56:24 org.apache.catalina.core.StandardContext start
严重: Context [/manager] startup failed due to previous errors
2017-2-17 17:56:24 org.apache.catalina.core.StandardContext stop
信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
manager] has not been started
2017-2-17 17:56:24 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8083
2017-2-17 17:56:24 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8014
2017-2-17 17:56:24 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/14 config=null
2017-2-17 17:56:24 org.apache.catalina.startup.Catalina start
信息: Server startup in 213 ms
但是网址可以访问,如下图:
2、关于报错的解决方案:
删除下图中的文件:
重新启动tomcat:
可以正常启动tomcat,并没有报错,网址可以正常访问,但无法访问tomcat网站。
原因是,删除webapps文件下的内容把tomcat网站的应用删除了,所以无法访问。
通过以上方案可以优化tomcat性能