Easy Access to Tomcat Users File from NetBeans IDE

Whenever I access the Tomcat Manager for the first time in a session, this little dialog box appears:

For details on this from Tomcat's site, click here.

What then happens is that I've got to dig into the IDE's user directory to find a file called tomcat-users.xml, which includes a user called "ide" (which is assigned the role of "manager") together with an IDE-generated password. The digging is a bit frustrating, so I'm using this Ant script instead:

<target name="ShowTomcatUsers">
  <property name="file" location="my-user-dir\\jakarta-tomcat-5.5.7_base\\conf\\tomcat-users.xml"/>
  <exec executable="c:\\Program Files\\Vim\\vim63\\gvim.exe">
     <arg value="${file}"/>
  </exec>
</target>

I've just added it to the build.xml file, together with a shortcut so that whenever I need it I can just click a button or a menu item in the IDE to display the file:

Just one of the many benefits of Ant integration in the IDE...

NB: Because the authorization dialog box is modal, I need to click out of it and then use the shortcut to access the Tomcat users file. So I need to work out some way of calling the ShowTomcatUsers target automatically whenever the Tomcat Manager needs to be authorized. It could be called from the Run target, except that I haven't worked out yet how to test whether the Tomcat Manager needs a password. Only in that instance would the file need to be called.

Comments:

1. Do you have to add this for each and every web project (since build.xml is a per-project file)? 2. Since the "file" property is static (i.e., there's only one tomcat-users.xml file), couldn't you simply look it up once and make a note of it in a file somewhere on your desktop?

Posted by Jaspreet Singh on May 22, 2005 at 01:26 AM PDT #

1. No, because even though build.xml is a per-project file, you could create a build.xml that contains only IDE-level tasks and then hook those tasks to the IDE's menu. 2. Yes. But I like Ant, so I'm trying to do even the simplest things in Ant, partly to prove that its possible and partly just for the fun of it. Thanks for the question and apologies for answering late. Geertjan

Posted by Geertjan on May 29, 2005 at 07:28 PM PDT #

afdas

Posted by guest on September 02, 2005 at 12:05 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
24
25
26
27
28
29
30
   
       
Today