You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tom Robinson <to...@constantstream.com> on 2007/02/16 15:51:13 UTC

IOException writing to /usr/share/tomcat5/conf/tomcat-users.xml.new

Hi

I've been setting up tomcat5 with great success and have a couple of
webapps working.

Next I thought I'll put the manager application in place and after a few
difficulties with the UserDatabase finally got it configured with a
memory Realm as discussed in the documentation for the manager app.

Ok, so all was working yesterday. Now I get an IOException about writing
to a file I don't have! Bizaarly tomcat wants a file called
tomcat-users.xml.new when I use tomcat-users.xml? What is that about?

exception, server.xml, and manager.xml (context) are below.

Any help is appreciated.

2007-02-16 14:01:25 UserDatabaseRealm[Local]: Exception looking up
UserDatabase under key UserDatabase
javax.naming.NamingException: IOException writing to
/usr/share/tomcat5/conf/tomcat-users.xml.new
at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
at
        org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:252)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
at
        org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at
        org.apache.catalina.core.StandardService.start(StandardService.java:480)
at
        org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)

server.xml:

<Server port="8005" shutdown="SHUTDOWN" debug="0">

<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
            debug="0"/>

<Listener
  className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
            debug="0"/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>

  </GlobalNamingResources>

  <Service name="Local">

    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
    <Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000" 
               disableUploadTimeout="true" />

    <Engine name="Local" defaultHost="localhost" debug="0">

        <Logger className="org.apache.catalina.logger.FileLogger"
            verbosity="4"
            directory="logs"
            prefix="local-engine." suffix=".out"
            timestamp="true"/>

        <Valve className="org.apache.catalina.valves.AccessLogValve"
            prefix="local-engine-access_log." suffix=".txt"
            pattern="combined"/>

        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
            debug="0" resourceName="UserDatabase"/>

        <!-- localhost Begin -->
        <Host name="localhost"
            debug="10"
            appBase="webapps"
            unpackWARs="true"
            autoDeploy="true" >

            <Logger className="org.apache.catalina.logger.FileLogger"
                directory="logs"
                prefix="localhost." suffix=".txt"
                timestamp="true"/>

            <Valve className="org.apache.catalina.valves.AccessLogValve"
                prefix="localhost-access_log." suffix=".txt"
                pattern="common"/>

        </Host>
        <!-- localhost End -->

    </Engine>

  </Service>

---8<---
cut other Service 
---8<---
</Server>

manager.xml context:
<!--

    Context configuration file for the Tomcat Manager Web App

    $Id: manager.xml,v 1.2 2004/02/20 17:09:29 remm Exp $

-->


<Context path="/manager"
docBase="${catalina.home}/server/webapps/manager"
        debug="0" privileged="true">

  <!-- Link to the user database we will get roles from -->
  <ResourceLink name="users" global="UserDatabase"
                type="org.apache.catalina.UserDatabase"/>

  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
                allow="127.0.0.1"/>

</Context>



Powered by Open-Xchange.com


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: IOException writing to /usr/share/tomcat5/conf/tomcat-users.xml.new

Posted by Tom Robinson <to...@constantstream.com>.
On Feb 16, 2007 03:01 PM, "Caldarale, Charles R"
<Ch...@unisys.com> wrote:

> > From: Tom Robinson [mailto:tom@constantstream.com] 
> > Subject: IOException writing to 
> > /usr/share/tomcat5/conf/tomcat-users.xml.new
> > 
> > Bizaarly tomcat wants a file called tomcat-users.xml.new
> > when I use tomcat-users.xml? What is that about?
> 
> Tomcat always updates tomcat-users.xml during startup, so the
> directory
> it's in must be write-enabled for the Tomcat userid.  (It actually
> writes the .new file, then renames that to remove the .new extension.)
> 

Thanks Chuck, this makes sense but I'm not sure when the directory
settings changed. Currently I have CATALINA_HOME=/usr/share/tomcat5 and:

lrwxrwxrwx 1 root root 12 Jan 17 01:59 /usr/share/tomcat5/conf ->
/etc/tomcat5
drwxrwxr-x  4 root tomcat4 4096 Feb 16 15:06 /etc/tomcat5

So I should chown tomcat4 /etc/tomcat5?

Regards,

Tom




Powered by Open-Xchange.com


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: IOException writing to /usr/share/tomcat5/conf/tomcat-users.xml.new

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Tom Robinson wrote:
> On Feb 16, 2007 03:18 PM, Markus=?iso-8859-1?q?Sch=F6nhaber?=
>
> <ma...@schoenhaber.de> wrote:
> > Caldarale, Charles R wrote:
> > > > From: Tom Robinson [mailto:tom@constantstream.com]
> > > > Subject: IOException writing to
> > > > /usr/share/tomcat5/conf/tomcat-users.xml.new
[...]
> > > Tomcat always updates tomcat-users.xml during startup, so the
> > > directory
> > > it's in must be write-enabled for the Tomcat userid.  (It actually
[...]
> Thanks to you both, but I still get the exception.
>
> Firstly I tried changing the directory permissions
>
> chown tomcat4 /etc/tomcat5 --- no luck there
> chmod 777 /etc/tomcat5 ---- also not working on restart

Hm, it seems expectable to me that changing the permissions of
/etc/tomcat5
won't make any difference, since the Exception says that it's
/usr/share/tomcat5/conf/tomcat-users.xml.new
which can't be written to.
You should try and change the permissions of /usr/share/tomcat5/conf - this 
is "the directory it's in" Chuck referred to.

> I set the directory permissions back and tried to make the resource
> readonly but still get the exception. Am I missing something fundamental
> here?

Guessing[1] from the layout of the UserDatabase Resource in your server.xml, 
you're propably using Tomcat 5.0.x. AFAIR, the "readonly" parameter was 
introduced in some version of 5.5.x.

Regards
  mks

[1] If you mention the exact version of Tomcat you're having a problem with, 
it's much easyer for others to provide help and you avoid getting hints which 
don't apply to the problem because someone like me mis-guessed the version of 
Tomcat you use.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: IOException writing to /usr/share/tomcat5/conf/tomcat-users.xml.new

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Tom Robinson [mailto:tom@constantstream.com] 
> Subject: Re: IOException writing to 
> /usr/share/tomcat5/conf/tomcat-users.xml.new
> 
> I set the directory permissions back and tried to make the resource
> readonly but still get the exception. Am I missing something 
> fundamental here?

Are you sure the Tomcat you're starting up is the one you're
configuring?  Can you try it with a clean Tomcat installation?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: IOException writing to /usr/share/tomcat5/conf/tomcat-users.xml.new

Posted by Tom Robinson <to...@constantstream.com>.
On Feb 16, 2007 03:18 PM, Markus=?iso-8859-1?q?Sch=F6nhaber?=
<ma...@schoenhaber.de> wrote:

> Caldarale, Charles R wrote:
> > > From: Tom Robinson [mailto:tom@constantstream.com]
> > > Subject: IOException writing to
> > > /usr/share/tomcat5/conf/tomcat-users.xml.new
> > >
> > > Bizaarly tomcat wants a file called tomcat-users.xml.new
> > > when I use tomcat-users.xml? What is that about?
> >
> > Tomcat always updates tomcat-users.xml during startup, so the
> > directory
> > it's in must be write-enabled for the Tomcat userid.  (It actually
> > writes the .new file, then renames that to remove the .new
> > extension.)
> 
> One can tell Tomcat to not touch the tomcat-users.xml by setting 
> the "readonly"-attribute of the UserDatabase Resource to "true", i. e.
> like
> that:
>     <Resource name="UserDatabase" auth="Container"
>               type="org.apache.catalina.UserDatabase"
> description="User database that can be updated and saved"
> factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>               pathname="conf/tomcat-users.xml"
>               readonly="true"/>

Thanks to you both, but I still get the exception.

Firstly I tried changing the directory permissions

chown tomcat4 /etc/tomcat5 --- no luck there
chmod 777 /etc/tomcat5 ---- also not working on restart

I set the directory permissions back and tried to make the resource
readonly but still get the exception. Am I missing something fundamental
here?

t.

Powered by Open-Xchange.com


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: IOException writing to /usr/share/tomcat5/conf/tomcat-users.xml.new

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Caldarale, Charles R wrote:
> > From: Tom Robinson [mailto:tom@constantstream.com]
> > Subject: IOException writing to
> > /usr/share/tomcat5/conf/tomcat-users.xml.new
> >
> > Bizaarly tomcat wants a file called tomcat-users.xml.new
> > when I use tomcat-users.xml? What is that about?
>
> Tomcat always updates tomcat-users.xml during startup, so the directory
> it's in must be write-enabled for the Tomcat userid.  (It actually
> writes the .new file, then renames that to remove the .new extension.)

One can tell Tomcat to not touch the tomcat-users.xml by setting 
the "readonly"-attribute of the UserDatabase Resource to "true", i. e. like 
that:
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml"
              readonly="true"/>

Regards
  mks

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: IOException writing to /usr/share/tomcat5/conf/tomcat-users.xml.new

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Tom Robinson [mailto:tom@constantstream.com] 
> Subject: IOException writing to 
> /usr/share/tomcat5/conf/tomcat-users.xml.new
> 
> Bizaarly tomcat wants a file called tomcat-users.xml.new
> when I use tomcat-users.xml? What is that about?

Tomcat always updates tomcat-users.xml during startup, so the directory
it's in must be write-enabled for the Tomcat userid.  (It actually
writes the .new file, then renames that to remove the .new extension.)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org