java - How do I create a virtual directory in Tomcat 7? -
tomcat installed @ c:\tomcat7\ want deploy .war files in c:\myapp\xyz. example, might have c:\myapps\xyz\myapp.war , should able reach path http://localhost:8080/myapp.
i tried appending bottom of c:\tomcat7\conf\server.xml
<host name="myapp" appbase="c:\myapps\xyz\" unpackwars="true" autodeploy="true"> </host> </engine> </service> </server>
this doesn't seem work though don't see myapp listed in management console , not able hit url. else need do?
also, unrelated but, how can not have name of war file tied context name or url path? example, want http://localhost/coolname point c:\myapps\xyz\myapp.war.
unfortunately way tomcat loads war filename tricky limitation.
i use different & os-specific approach: "symbolic links". isn't direct answer, may out anyway.
caveats:
- i use linux, is
possible in windows vista &
windows 7. - using wars still awkward using method. wars zip files, best unzip war a
version-named folder.
solution:
create symbolic links (like virtual directory on filesystem) myapps folder webapps folder.
- this enables "coolname", "coolname-v2", etc.
- each webapp potentially kept in different places in filesystem
- you can 'roll back' or 'upgrade' removing , re-adding symbolic links different targets (make sure "stop" webapp while switching)
linux:
ln -s target_name link_name
vista/windows 7:
mklink link_name target_name
in way, can still use c:\tomcat7\webapps\ , specify symbolic links follows:
mklink c:\tomcat7\webapps\coolname\ c:\myapps\xyz\webapp123\
(note: wars, you'd need unzip war first)
hth
Comments
Post a Comment