views:

2961

answers:

5

I am deploying my Java application with Ant. Unfortunately my test deployment on the local machine doesn't work because of Vista. The Program Files directionaries are protected and i don't want to start Ant or Eclipse as an Admin. So i had the idea to move my webapps folder to a workspace subfolder, so i can use relative paths in Ant as well.

The solutions seems to be to modify the Host element in the server.xml. With Linux it isn't such a deal:

  <Host name="localhost"  appBase="/path/to/webapps"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">

But with Windows i don't get it right. I tried every possible combinations i could imagine, like:

      C://Users//maerch//Workspaces//Tomcat6.0_webapps
      C:/Users/maerch/Workspaces/Tomcat6.0_webapps
      C:\Users\maerch\Workspaces\Tomcat6.0_webapps
      C:\\Users\\maerch\\Workspaces\\Tomcat6.0_webapps
      C://Users//maerch//Workspaces//Tomcat6.0_webapps\\
      C:/Users/maerch/Workspaces/Tomcat6.0_webapps/
      C:\Users\maerch\Workspaces\Tomcat6.0_webapps\
      C:\\Users\\maerch\\Workspaces\\Tomcat6.0_webapps\\

The path is also correct, but it doesn't work. There are also no error messages in the log files neither the browser shows a 404 message or anything else. Just a white page without title and so on. Can anyone help?

+1  A: 

The following should work in Windows:

C:/Users/maerch/Workspaces/Tomcat6.0_webapps/
/Users/maerch/Workspaces/Tomcat6.0_webapps/

Windows also support Unix's slash (/), so it's a good idea to use this instead of Windows's (\). Also the 'default root' for Windows is C:, so you shouldn't need it in an absolute path.

I don't think this is a problem with the path. Perhaps you could try use a relative path:

"../../../Users/..."

It may also be good idea to install Tomcat in a directory where you have full access.

kgiannakakis
+1  A: 

I have very the same security issue with Vista and I resolve it by providing "Full control" access level for "Users" group on "Program Files\Apache Software Foundation\Tomcat XYZ" folder.

It resolved deployment issues with tomcat for me as well as question on starting tomcat as a service. Of course you can assign permissions more strictly (per deployment user group or per user). IMO it's more quicker way then reconfigure the tomcat.

Regarding your original question how to change path outside of ${catalina.home} under Windows:

It's very the same as you have to accomplish it on *nix:

  <Host name="localhost"  appBase="/c:/webapps2"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">

Did you have ROOT folder in you folder mentioned in appBase? The approach is tested under Tomcat 6.0

FoxyBOA
You are right. I don't know why i didn't think about this. Solves my problem, but unfortunately its not an answer for the questions, so you get only your reputations up! ;-)I am still interested in solving this. Found a lot of websites which haven't a clue.
Maerch
P.S. Its not really related to the issue, but a rule of thumb for me, I am not on windows anymore, but I remember as a best practice I never used a <space> in the path, where I installed all those things. I always installed programs in some <space>less path.
Adeel Ansari
Regarding space in file/folder names: I'm completely agree with Vinegar, but it's not point of view Microsoft anymore. For a long time default directory for 3-rd party software is "Program Files" or "Program Files (x86)".
FoxyBOA
A: 

for windows

appBase="c://webapps2"

A: 

The appBase accept the path valid for the system - "C:\folder\" for win or "/usr/bin/" for Linux or Unix. So the you don't need to change the slashes. You should make a folder called "ROOT" (capital letters) inside the the directory, you`ve maked the nes default webapps directory.

<Host name="localhost" appBase="C:\web\www\"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">

But there will be "C:\web\www\ROOT\" I`ve tested it on Windows.

Bakudan
A: 

Hi

What if you copy the same webapps directory to another location and change the path in server.xml file. If we would do this then definitely i believe we won't have any probs because whenever things webapps need to deploy an application it will have.

Thanks & Best regards, Kiran

Kiran