To whom it may concern, On 2/25/16 4:08 PM, gmc filter wrote: > Hi all, > I'm having some trouble with tomcat and symbolic links. I am working with > OSX and I use a local instance of Tomcat to do some testing before > deploying my site elsewhere. > > What I want to do: I'd like to create a small script which will stop > tomcat, clear out old deployment folders, rebuild my project, copy the > resulting WAR file to the webapps folder, restart tomcat, wait for > deployment to finish, and finally replace a JSP file with a symbolic link > to the corresponding file that is in my workspace. > > Why I want to do this: I'd like to be able to quickly rebuild and redeploy > my WAR and also edit my JSP files and see those changes by simply > refreshing the already-open page. > > My problem: I have all of the above steps working so far. However, as soon > as I swap out the real index.JSP with a link to the one in my workspace, I > can no longer load the page, I get a 404 error instead. > > What I have tried: I have found questions like mine asked many times and > usually the solution is to hunt down a "context.xml" file and add a tag > into that file, 'allowLinking="true"'. I have tried to add this tag into > "<tomcat home>/libexec/conf/context.xml", "<tomcat > home>/libexec/conf/Catalina/localhost/context.xml" (created this one) and > also "<tomcat home>/libexec/webapps/appname/META-INF/context.xml". After > multiple restarts, none of those seem to change any functionality that I > can see. > > By trial and error, I have eventually found that if I follow these steps, I > can get the link to work for a little while... > Deploy the WAR > Load the page (It works) > Move index_bs.jsp to index_bs.jsp.bak (in the webapp directory) > Load the page (404, as expected) > Create a symbolic link from index_bs.jsp to index_bs.jsp.bak > Load the page (It works!) > Edit index_bs.jsp.bak, save > Load the page (404 again) > > This seems very strange to me. Obviously I've reached a point where > symbolic linking works somewhat, but as soon as I edit the original file > (my main goal here) the link stops working as expected. Does anyone know > what I'm doing wrong here? I must be missing something... > > > Some information about my setup: > OSX 10.10.5 > Tomcat 8.0.28 installed with my username running brew brew to > "/usr/local/Cellar/tomcat/8.0.28/" > "/usr/local/Cellar/tomcat/8.0.28/libexec/webapps/hue-web-1.0-SNAPSHOT.war" > deployed successfully to > "/usr/local/Cellar/tomcat/8.0.28/libexec/webapps/hue-web-1.0-SNAPSHOT/" > Target file is > "/Users/uid/mygithub/hue-stuff/hue-web/src/main/webapp/index_bs.jsp"
If you need an IDE-independent build process (which I highly recommend), consider something like Apache ant (similar to UNIX "make" but way better for the Java world) or even Maven, if you don't mind the overhead. Using symlinks with Tomcat is sometimes problematic, though I can't explain why it's actually failing for your specific case... I would have expected that to work. -chris --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org