Understanding context.xml in tomcat 6

后端 未结 2 1559
一生所求
一生所求 2021-02-09 21:15

I created a mainly empty dynamic web project in eclipse.

It has

  • no servlets
  • no jsp files

The web.xml is



        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-09 21:39

    I think this is a bug in Tomcat. I filed a bug report but they claim it works as designed. Tomcat has 3 modes of deployment: Directory, WAR and Context Fragment. In your case, it gets confused when reloading.

    Here is the sequence leading to the error,

    1. When you deploy the WAR, the context fragment (META-INF/context.xml) is copied to conf/Catalina/[host] directory.
    2. When you modifies the fragment, it correctly detects the change so redeployment is triggered.
    3. However, it forgets this is a WAR deployment and treats it as Directory deployment. The directory is removed by undelpoy so you get the error.

    If you only change the XML in META-INF, everything should work for you.

提交回复
热议问题