5 Replies Latest reply on Jul 25, 2007 3:18 AM by Gergely Vitarius

    Why does JBoss rewrite web.xml

    Paul Anderson Newbie

      I have noticed that 'touch' on the web.xml does not redeploy the web application due to JBoss rewriting the web.xml file.

      web.xml (original):

      <?xml version="1.0" encoding="ISO-8859-1"?>

      <web-app version="2.4"
      xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd">

      <!-- The Welcome File List -->
      <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>

      <!-- Servlets -->

      <servlet-name>TestWebService</servlet-name>
      <servlet-class>com.company.department.ws.TestWebService</servlet-class>


      <!-- Servlet Mappings -->
      <servlet-mapping>
      <servlet-name>TestWebService</servlet-name>
      <url-pattern>/webservice/TestWebService</url-pattern>
      </servlet-mapping>

      </web-app>

      When JBoss is restarted the web.xml is rewritten to the below:

      <web-app version='2.4' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd'>
      <!-- The Welcome File List -->
      <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
      <!-- Servlets -->

      <servlet-name>TestWebService</servlet-name>
      <servlet-class>org.jboss.ws.integration.jboss42.JBossServiceEndpointServlet</servlet-class>
      <init-param>
      <param-name>ServiceEndpointImpl</param-name>
      <param-value>com.company.department.ws.TestWebService</param-value>
      </init-param>


      <!-- Servlet Mappings -->
      <servlet-mapping>
      <servlet-name>TestWebService</servlet-name>
      <url-pattern>/webservice/TestWebService</url-pattern>
      </servlet-mapping>
      </web-app>

      My question is why does JBoss rewrite the web.xml. If it must rewrite the web.xml shouldn't it do this and leave in memory (JVM) and not overwrite the original web.xml? Because of this I have to have an original web.xml written as another file (like web.xml.org) and have an ant task to copy the original web.xml (web.xml.org) to web.xml. It's just bothersome. Is there a quicker way to redeploy an exploded war that I do not know?