tomcat报错之Error starting static Resources

一、情景简介

  • Docker + Tomcat + jenkins
  • Dockerfile如下
  1. #Games
  2. #Version: 1.0.0
  3. #Author: chuck
  4. #Base image:hexunzq/java:1.0
  5. FROM docker-registry.52devops.com/hexunzq/javaweb:1.0
  6. MAINTAINER shihang "chuck@52devops.com"
  7. ENV GAMESPATH /usr/local/tomcat/webapps/MatchGames/
  8. ADD MatchGames/ $GAMESPATH
  9. RUN find $GAMESPATH -type d -name .svn | xargs rm -rf

tomcat的server.xml如下:

  1. <?xml version='1.0' encoding='utf-8'?>
  2. <Server port="8005" shutdown="SHUTDOWN">
  3. <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  4. <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  5. <Listener className="org.apache.catalina.core.JasperListener" />
  6. <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  7. <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  8. <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
  9. <GlobalNamingResources>
  10. <Resource name="UserDatabase" auth="Container"
  11. type="org.apache.catalina.UserDatabase"
  12. description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
  13. pathname="conf/tomcat-users.xml" />
  14. </GlobalNamingResources>
  15. <Service name="Catalina">
  16. <Connector port="8092"
  17. protocol="org.apache.coyote.http11.Http11NioProtocol"
  18. maxThreads="10000"
  19. connectionTimeout="20000"
  20. acceptCount="8000"
  21. redirectPort="8443"
  22. disableUploadTimeout="false"
  23. URIEncoding="UTF-8"
  24. />
  25. <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
  26. <Engine name="Catalina" defaultHost="localhost">
  27. <Realm className="org.apache.catalina.realm.LockOutRealm">
  28. <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
  29. resourceName="UserDatabase"/>
  30. </Realm>
  31. <Host name="games.hexun.com"
  32. unpackWARs="true" autoDeploy="true">
  33. <Context docBase="games" path="" reloadable="true" />
  34. <Valve className="org.apache.catalina.valves.AccessLogValve"
  35. directory="logs/games"
  36. prefix="" suffix="_access_log"
  37. pattern="%{yyyy-MM-dd HH:mm:ss}t games.hexun.com %p %h %D %m %U %q %s 0 0 &quot;%{User-Agent}i&quot; &quot;%{Referer}i&quot;"
  38. fileDateFormat="yyyy-MM-dd_HH"/>
  39. </Host>
  40. </Engine>
  41. </Service>
  42. </Server>

二、Docker状态and日志详情

由于不正常启动tomcat,docker也是非正常的,表现如下,docker
一直处于restarting状态

  1. [root@gameweb-18124 ~]# docker ps -a
  2. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  3. e4c3a443bddb docker-registry.hexun.com/hexunzq/games:1.0.0
  4. "catalina.sh run" 33 seconds ago Restarting (0) 9 seconds ago 8080/tcp, 0.0.0.0:8092->8092/tcp games

docker的日志是挂载到宿主机的,从日志中看出如下报错

  1. SEVERE: Error starting static Resources
  2. org.apache.catalina.core.StandardContext resourcesStart

三、解决办法(谷歌)

点击进入链接谷歌解决
修改了server.xml中的和dockerfile的站点路径保持一致,重新run容器,搞定!

0
未经许可,不得转载,否则将受到作者追究,博主联系方式见首页右上角

该文章由 发布

这货来去如风,什么鬼都没留下!!!
发表我的评论
取消评论
代码 贴图 加粗 链接 删除线 签到