aspose file tools*
The moose likes Tomcat and the fly likes trying to edit server.xml but is read only Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "trying to edit server.xml but is read only" Watch "trying to edit server.xml but is read only" New topic
Author

trying to edit server.xml but is read only

pakske fritten
Greenhorn

Joined: May 30, 2012
Posts: 5
Hi all
newbie here.
Trying to deploy web applications to tomcat using this tutorial: http://oreilly.com/pub/a/java/archive/tomcat.html?page=2 .
I am trying to add one line to server.xml in /tomcat6/config/ ; namely
<Context path="/onjava" docBase="onjava" debug="0" reloadable="true" />

However I cannot make the changes that they suggest to the server.xml file. It says it is read-only and won't let me edit it... Anyone know how to do this?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

Change the permissions on the file.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
pakske fritten
Greenhorn

Joined: May 30, 2012
Posts: 5
thanks for excellent response time. didnt know you could do this, but it worked with "gksu gedit"

However, how do I change settings for a hole directory? I want to create a new directory in /var/lib/tomcat6/webapps/ .
I can not right click on it in the ubuntu explorer; and also in a shell chmod 755 tomcat6/ does not seem to work.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

You should not attempt to modify server.xml for webapp contexts. That is discouraged since at least Tomcat4, and we're on Tomcat 6 or 7 now. There is a special directory designed to hold Context definitions, or you can put the Context into a file named META-INF/context.xml in the WAR.

You should very definitely not attempt for applications to write files anywhere within the Tomcat directory tree, and that includes anywhere within or under webapps. If you're attempting to copy a WAR file or exploded WAR directory under webapps to deploy it there, you'll need write access rights. If you cannot obtain access rights, you can use the Tomcat manager webapp to upload the WAR, if you're authorized to use it, or you can leave the webapp outside of Tomcat altogether and point to its location using the Context and an absolute path. If you do that, Tomcat has to have read access rights for that location, of course.


Customer surveys are for companies who didn't pay proper attention to begin with.
pakske fritten
Greenhorn

Joined: May 30, 2012
Posts: 5
OK,
but the tutorial http://oreilly.com/pub/a/java/archive/tomcat.html tells me to do these things, and in the comments lots of people seem to like it. It tells me to:

1) "creating the directory directly in the Tomcat /webapps directory" (page 1)
2) "add the following entry to the TOMCAT_HOME/conf/server.xml file" (page 2)

since I'm stuck at the bottom of page 2 it might be since I havent done 1) and 2)

THanks!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

Did you look at the date on that page?

It's 2001!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trying to edit server.xml but is read only