Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trying to edit server.xml but is read only

 
pakske fritten
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64980
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change the permissions on the file.
 
pakske fritten
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18218
53
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
pakske fritten
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18218
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you look at the date on that page?

It's 2001!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic