로컬에서는 한번만 실행하면 되는데 linux 서버에 올리면 두번이 실행되었다.
왜그런지 블로그 다른글을 찾아보니 원인이 잘정리 되어있는듯 하지만 무슨말인지 이해하기가 힘들었다.
http://blog.ajkuhn.com/116
블로그내용을 보니 아래와같은 내용이 있었다.
Tomcat에서 동일한 Web Application Context 두 개가 뜬다한들 작동에는 별 문제가 없을 것이다. 둘의 ContextPath가 다르다면 말이다. 위의 경우 Host에서는 "test"라는 ContextPath로 webapp가 떴을 것이고, Context에서는 지정한대로 ""(=루트) ContextPath로 떴으니 아무런 문제가 없었던 건이다.
여튼 Tomcat설정시 Host의 appBase위에 Context로 설정할 app를 올리지 말아야한다. 이는 의도하지않은 작동을 야기한다. 본인은 다양한 이유로 appBase의 위치를 바꾸는 방법을 택했다.
이해가안가서 영문으로된걸로 찾아보니 스택오버플로우에 완전히 잘정리된 글이있었다.
http://stackoverflow.com/questions/7223108/quartz-job-runs-twice-when-deployed-on-tomcat-6-ubuntu-10-04lts
When using automatic deployment, the docBase defined by an XML Context file should be outside of the appBase directory. If this is not the case, difficulties may be experienced deploying the web application or the application may be deployed twice. The deployIgnore attribute can be used to avoid this situation.
Finally, note that if you are defining contexts explicitly in server.xml, you should probably turn off automatic application deployment or specify deployIgnore carefully. Otherwise, the web applications will each be deployed twice, and that may cause problems for the applications.
해결책은
1.위에분과같이 톰켓 host 설정의 appBase를 바꾸는 방법과
2. 오토디플로이 옵션과 , 디플로이온 스탈트업을 끄는 방법이있다.
<Host name="localhost"
deployOnStartup="false"
appBase="webapps"
unpackWARs="false"
autoDeploy="false">
2번에 관해정리된곳이 없는거같아 글을 써본다.
구글봇이 잘긁어갔으면 좋겠다.
끗
'서버' 카테고리의 다른 글
[ubuntu] apache 서버 소스코드 설치 (0) | 2017.04.10 |
---|