tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Chaney <a...@compulsivecreative.com>
Subject Re: Sudden and unexpected exception at Tomcat startup
Date Sun, 28 Dec 2008 16:08:29 GMT
Hi Andre

Tomcat DOES in fact rewrite the tomcat-users.xml file during startup. 
This has been mentioned on this list several times as being insecure but 
the general opinion is that you should not be using the 
MemoryUserDatabaseRealm in production.

Actually, I found that not only does it rewrite it, but it also uses the 
current umask so that it is quite likely that the file will become 
world-readable. You should probably do what the gurus suggest and switch 
to a more robust realm (eg JDBC etc)

Here are some suggestions you have probably already tried:


What are the permissions on the /svr/www/tomcat/base/conf folder?

Are you sure that the user that tomcat runs as can write to that folder?

Have you checked that tomcat is running as the user that you expect?

Is it possible that there is a filing system error or even a disk error?




Regards

Alan Chaney


André Warnier wrote:
> Hi.
> 
> Does someone have an idea of what is going as per the logfile 
> catalina.out below ?
> What is this IOException all about ?
> 
> This is a Tomcat 5.0.x under Suse Enterprise Linux 10.1, which had been 
> working fine until now and suddenly logs this at startup.
> This Tomcat runs under an IBM JVM 1.5.
> 
> Tomcat is started, as per the listening ports and the "ps" display I can 
> see, but apparently the access to Tomcat (through Apache and mod_jk) 
> does not work anymore (tells me : The server is temporarily unable to 
> service your request due to maintenance downtime or capacity problems. 
> Please try again later. )
> 
> 
> Additional info :
> - the directory /srv/www/tomcat5/base/conf/ is writeable by the user 
> "tomcat" under which Tomcat is started.
> - To my knowledge, the server.xml has not been changed since the 
> previous succesful restart 2 days ago, and neither has tomcat-users.xml
> 
> 
> server.xml (excerpts) :
> ...
>     <!-- 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>
> ...
> (further under <Engine> and <Host> :)
> 
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>                  debug="0" resourceName="UserDatabase"/>
> ...
> 
> 
> 
> catalina.out :
> 
> 2008-12-28 13:21:58,543 [main] INFO 
> org.apache.catalina.core.StandardService - Starting service Catalina
> 2008-12-28 13:21:58,545 [main] INFO 
> org.apache.catalina.core.StandardEngine - Starting Servlet Engine: 
> Apache Tomcat/5.0
> 2008-12-28 13:21:58,548 [main] WARN  org.apache.naming.NamingContext - 
> Unexpected exception resolving reference
> java.io.IOException: IOException writing to 
> /srv/www/tomcat5/base/conf/tomcat-users.xml.new
>     at 
> org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.java:495) 
> 
>     at 
> org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:98)

> 
>     at 
> org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129)

> 
>     at 
> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:316)
>     at org.apache.naming.NamingContext.lookup(NamingContext.java:791)
>     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:79) 
> 
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

> 
>     at java.lang.reflect.Method.invoke(Method.java:618)
>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
> javax.naming.NamingException: IOException writing to 
> /srv/www/tomcat5/base/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:79) 
> 
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

> 
>     at java.lang.reflect.Method.invoke(Method.java:618)
>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
> 2008-12-28 13:21:58,549 [main] ERROR 
> org.apache.catalina.startup.Catalina - Catalina.start:
> LifecycleException:  No UserDatabase component found under key UserDatabase
>     at 
> org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:259) 
> 
>     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:79) 
> 
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

> 
>     at java.lang.reflect.Method.invoke(Method.java:618)
>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
> 2008-12-28 13:21:58,550 [main] INFO org.apache.catalina.startup.Catalina 
> - Server startup in 105 ms
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
> !DSPAM:49577b49258841336712104!
> 

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


Mime
View raw message