首先,我們來看下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的環境變量配置。