Is it possible to maintain tomcat configuration in server.xml, when deploying web apps via Eclipse?

StackOverflow https://stackoverflow.com/questions/14112130

  •  13-12-2021
  •  | 
  •  

Domanda

When webapps are deployed via Eclipse to Tomcat, $catalina_home/conf/server.xml is getting overwritten by Eclipse. This means, whatever changes I make to server.xml prior to app deployment is overwritten by Eclipse.

My application uses GridGain and hence I need to add the following line to server.xml:

<Listener className="org.gridgain.grid.loaders.tomcat.GridTomcatLoader" configurationFile="config/default-spring.xml"/>

Since Eclipse overwrites server.xml every time I deploy a new version of the app, I need to instruct Eclipse to insert the above line (this is applicable for all tomcat event listeners) as well during deployment. Is this possible? If not is there a workaround for GridGain based applications to be deployed via Eclipse?

È stato utile?

Soluzione

Eclipse uses ${workspace}/Servers/${server-name}/server.xml for its configuration. That directory is created when you setup a new server. It's not overwritten every time you deploy the app but only if you make changes in the server config UI. If you need to add something manually to server.xml then do so and set the file to read-only e.g. directly in Eclipse:

  • locate the file (see path above)
  • right-click
  • Properties
  • Resource
  • enable "Read only"

That way Eclipse will ask/notify you everytime it tries to alter the file and you can allow/disallow that.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top