首先,我們來看下tomcat在Vista下出錯的症狀——
警告: Unexpected exception resolving reference
Java.io.FileNotFoundException: C:Program Filestomcat6conftomcat-users.XML.new (拒絕訪問。)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream. <init>(FileOutputStream.java:179)
at java.io.FileOutputStream. <init>(FileOutputStream.java:131)
at org.Apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.java:521)
at org.Apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:104)
at org.Apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:140)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.Apache.naming.NamingContext.lookup(NamingContext.java:793)
at org.Apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.Apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113)
at org.Apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
at org.Apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:137)
at org.Apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:109)
at org.Apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:81)
at org.Apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.Apache.catalina.core.StandardServer.start(StandardServer.java:703)
at org.Apache.catalina.startup.Catalina.start(Catalina.java:578)
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:597)
at org.Apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.Apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
嚴重: Exception looking up UserDatabase under key UserDatabase
javax.naming.NamingException: C:Program Filestomcat6conftomcat-users.xml.new (拒絕訪問。)
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.java:253)
at org.Apache.catalina.core.ContainerBase.start(ContainerBase.java:1037)
at org.Apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.Apache.catalina.core.StandardService.start(StandardService.java:516)
at org.Apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.Apache.catalina.startup.Catalina.start(Catalina.java:578)
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:597)
at org.Apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.Apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2008-10-30 13:04:17 org.Apache.catalina.startup.Catalina start
嚴重: Catalina.start:
LifecycleException: No UserDatabase component found under key UserDatabase
at org.Apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:261)
at org.Apache.catalina.core.ContainerBase.start(ContainerBase.java:1037)
at org.Apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.Apache.catalina.core.StandardService.start(StandardService.java:516)
at org.Apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.Apache.catalina.startup.Catalina.start(Catalina.java:578)
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:597)
at org.Apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.Apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2008-10-30 13:04:17 org.Apache.catalina.startup.Catalina start
信息: Server startup in 82 ms
原因分析:
這個問題遇到過,原因是Vista系統下c盤是對users受寫保護的,那麼,Windows7下面是不是也會碰到這個問題呢?
解決方法:
1、裝到其他盤就沒有問題了。
2、找到$TOMCAT_HOME$conf,把conf文件夾設置為完全控制
(右鍵屬性-安全-找到當前登錄名-下面選擇完全控制)
保存,重啟TOMCAT 。
注意:
重要的是“當前登錄名”,不是“CREATOR OWNER”,也不是“Administrator”,如果沒有當前用戶的話,添加一個即可。
另外,啟動窗口一閃而過,很有可能是環境變量沒有配置。如果以上都不能解決再檢查
一下JAVA和TOMCAT的環境變量配置。
關鍵詞:TOMCAT Cat