1

我正在尝试运行 tomcat 5.5,但在启动服务器时出现以下错误。

java.io.IOException: Cannot rename original file to C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\tomcat-users.xml.old

下面是完整的堆栈跟踪。

`Jun 22, 2012 12:17:43 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 361 ms
Jun 22, 2012 12:17:44 PM org.apache.naming.NamingContext lookup
WARNING: Unexpected exception resolving reference
java.io.IOException: Cannot rename original file to C:\Program Files\Apache Soft
ware Foundation\Tomcat 5.5\conf\tomcat-users.xml.old
        at org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.
java:582)
        at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance
(MemoryUserDatabaseFactory.java:104)
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF
actory.java:140)
        at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
        at org.apache.naming.NamingContextBindingsEnumeration.nextElementInterna
l(NamingContextBindingsEnumeration.java:113)
        at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContext
BindingsEnumeration.java:71)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBe
ans(GlobalResourcesLifecycleListener.java:137)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBe
ans(GlobalResourcesLifecycleListener.java:109)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycle
Event(GlobalResourcesLifecycleListener.java:81)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:693
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 22, 2012 12:17:44 PM org.apache.catalina.mbeans.GlobalResourcesLifecycleList
ener createMBeans
SEVERE: Exception processing Global JNDI Resources
javax.naming.NamingException: Cannot rename original file to C:\Program Files\Ap
ache Software Foundation\Tomcat 5.5\conf\tomcat-users.xml.old
        at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
        at org.apache.naming.NamingContextBindingsEnumeration.nextElementInterna
l(NamingContextBindingsEnumeration.java:113)
        at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContext
BindingsEnumeration.java:71)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBe
ans(GlobalResourcesLifecycleListener.java:137)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBe
ans(GlobalResourcesLifecycleListener.java:109)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycle
Event(GlobalResourcesLifecycleListener.java:81)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:693
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 22, 2012 12:17:44 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 22, 2012 12:17:44 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.25
Jun 22, 2012 12:17:44 PM org.apache.naming.NamingContext lookup
WARNING: Unexpected exception resolving reference
java.io.IOException: Cannot rename original file to C:\Program Files\Apache Soft
ware Foundation\Tomcat 5.5\conf\tomcat-users.xml.old
        at org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.
java:582)
        at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance
(MemoryUserDatabaseFactory.java:104)
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF
actory.java:140)
        at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j
ava:253)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1006)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 22, 2012 12:17:44 PM org.apache.catalina.realm.UserDatabaseRealm start
SEVERE: Exception looking up UserDatabase under key UserDatabase
javax.naming.NamingException: Cannot rename original file to C:\Program Files\Ap
ache Software Foundation\Tomcat 5.5\conf\tomcat-users.xml.old
        at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j
ava:253)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1006)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 22, 2012 12:17:44 PM org.apache.catalina.startup.Catalina start
SEVERE: Catalina.start:
LifecycleException:  No UserDatabase component found under key UserDatabase
        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j
ava:261)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1006)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 22, 2012 12:17:44 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 102 ms

`

4

2 回答 2

1

尝试在您的 UserDatabase Resource 元素上设置 readonly="true"。这将阻止 Tomcat 尝试复制它。

潜在的问题是权限问题。无论 Tomcat 以哪个用户身份运行,都无权修改 conf 目录中的文件。

于 2012-06-22T07:26:43.210 回答
1

请通过这篇文章。你可能会对这个问题有所了解。

http://tomcat.10.n6.nabble.com/Tomcat-within-Eclipse-td2102784.html

于 2012-06-22T07:19:49.510 回答