开发者

I want to run a bash script when Tomcat deploys my web application from its .war file - is this possible?

(Tomcat version 5.5, in case it matters.)

I have a library in one of my web applications that needs to be configured with a machine-specific license before use. I don't want to put this library in shared/lib because at some point I may want to run multiple web applications with different versions of the library.

Right now the .jar files are stored in WEB-INF/lib. Thus, when I build the .war file and upload it to the server, the .jar file would still be the one bound to my PC. I would like to put a bash script somewhere in the webapp that Tomcat would automatically run when deploying the .war file - this script would then run the configuration script and bind the server's license file to the .jar. Is this possible? Is there a ni开发者_开发问答cer way of doing what I want?


You could create a ServletContextListener to do that in the contextInitialized() method. And from that listener you can run the "configuration script" directly, no other script required.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜