Posts

Showing posts with the label Tomcat

[Level 2] How to allow using symbolic link in tomcat? (with python code)

If you want to allow using symbolic link in tomcat, you could add and attribute called "context" with an key "allowLinking" eg. <Context path="/myapp" allowLinking="true"/> and I wrote a sample python code to do this. #!/bin/env python import os,sys from xml.dom import minidom def getXMLDom(FILE): return minidom.parse(open(FILE,'r')) def saveXML(FILE, dom): fd = open(FILE, 'w') fd.write(dom.toxml()) fd.close() def appendElement(FILE, base_element_name, element_name, attr_key_val, element_index=0, backup_flag='y'): if backup_flag == 'y': backupConfigFile(FILE) dom = getXMLDom(FILE) e = dom.createElement(element_name) for attr, val in attr_key_val: e.setAttribute(attr, val) dom.getElementsByTagName(base_element_name)[element_index].appendChild(e) saveXML(FILE, dom) xmlFile = prefix+'/opt/ruckuswireless/3rdparty/tomcat/conf/server.xml' base_element_...

[Level 2] How to create multi instances of tomcat.

If you want to create multi instances of tomcat, you can follow the below steps: 1. Copy logs, conf and webapps from origianl tomcat foler to a new location. # mkdir -p [a new folder you like] # cd [original tomcat folder] # cp ./logs ./conf ./webapps [a new folder you like] 2. Set environment variables "CATALINA_BASE" to the above path. # export CATALINA_BASE=[a new folder you like] 3. Startup tomcat. # [original tomcat folder]/bin/startup.sh And what's the difference between CATALINA_BASE and CATALINA_HOME, the decision path is as below: 1. Decide CATALINA_BASE: If you have CATALINA_BASE, the base directory is CATALINA_BASE, if not, the real path of binary would be the CATALINA_BASE. 2. Decide CATALINA_HOME: If you have CATALINA_HOME, the webapps base directory is in CATALINA_HOME, if not, the CATALINA_BASE would be the CATALINA_HOME. Wish this helps. regards, Stanley Huang