剛配置完Tomcat,想在Eclipse下試一試,隨便些了個(gè)HelloWorld,然后Run on Server。Eclipse之前沒有建過Sever的,于是提示要創(chuàng)建一個(gè)Server,但是沒想到給了我個(gè)錯(cuò)誤提示:
Could not load the Tomcat server configuration at /opt/tomcat/conf. The configuration may be corrupt or incomplete.
本以為是環(huán)境變量配置錯(cuò)誤。檢查了一下,沒有問題,而且Eclipse以外,直接運(yùn)行服務(wù)器也正常。
折騰了半天,看了下
cyril@405Studio:/opt$?sudo?ls?-l?tomcat
total?68
drwxr--r--?2?root?root??4096?2006-07-23?17:39?bin
drwxr--r--?6?root?root??4096?2006-04-15?02:09?common
drwxr--r--?3?root?root??4096?2006-07-23?19:41?conf
-rwxr--r--?1?root?root?11357?2006-04-15?02:11?LICENSE
drwxr--r--?2?root?root??4096?2006-07-23?18:20?logs
-rwxr--r--?1?root?root???688?2006-04-15?02:11?NOTICE
-rwxr--r--?1?root?root??6384?2006-04-15?02:09?RELEASE-NOTES
-rwxr--r--?1?root?root??6964?2006-04-15?02:11?RUNNING.txt
drwxr--r--?5?root?root??4096?2006-04-15?02:09?server
drwxr--r--?4?root?root??4096?2006-04-15?02:09?shared
drwxr--r--?2?root?root??4096?2006-07-23?17:39?temp
drwxr--r--?8?root?root??4096?2006-04-15?02:09?webapps
drwxr--r--?3?root?root??4096?2006-07-23?18:20?work
看樣子可能是權(quán)限的問題。
于是
sudo chmod -R 777 /opt/tomcat/
再次啟動Eclipse創(chuàng)建服務(wù)器完成!
總結(jié):
Eclipse使用Tomcat作為服務(wù)器來開發(fā)的時(shí)候,需要對tomcat安裝目錄的文件進(jìn)行讀寫操作,所以應(yīng)該賦予Eclipse對tomcat安裝目錄的讀寫權(quán)限。