2013-04-01 210 views
1

我想讓我的java應用程序部署在tomcat服務器上(在Windows中),我得到以下錯誤。請幫助我解決以下連接錯誤的一些指導原則。我有管理員權限,服務器在本地運行。使用capistrano部署java應用程序

C:\builds>cap local deploy 
DL is deprecated, please use Fiddle 
    * 2013-04-01 14:19:06 executing `local' 
    * 2013-04-01 14:19:06 executing `deploy' 
    * 2013-04-01 14:19:06 executing `deploy:update' 
** transaction: start 
    * 2013-04-01 14:19:06 executing `deploy:update_code' 
    * executing "xcopy C:/_Savita/app/my-app \"C:/builds/releases/20 
130401084906\" /S/I/Y/Q/E && (echo > C:/builds/releases/20130401084906/REVISION 
)" 
    servers: ["localhost"] 
*** [deploy:update_code] rolling back 
    * executing "rm -rf C:/builds/releases/20130401084906; true" 
    servers: ["localhost"] 
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionErr 
or, connection failed for: localhost (Errno::ECONNREFUSED: No connection could b 
e made because the target machine actively refused it. - connect(2)) 
connection failed for: localhost (Errno::ECONNREFUSED: No connection could be ma 
de because the target machine actively refused it. - connect(2)) 

請找到部署腳本以下使用

set :application, "myApp" 
#set :scm, "git" 
set :repository, "C:/_Savita/app/my-app" 
#set :branch, "master" 

default_run_options[:pty] = true 
ssh_options[:forward_agent] = true 

task :local do 
    roles.clear 
    server "localhost", :app 
    set :user, "Savita Doddamani" 
    set :java_home, "C:/Program Files (x86)/Java/jdk1.6.0_25" 
    set :tomcat_home, "C:/Program Files (x86)/Apache Software Foundation/Tomcat 6.0" 
    set :tomcat_manager, "user" 
    set :tomcat_manager_password, "pwd" 
    set :maven_home, "C:/_Savita/softwares/apache-maven-2.2.1" 
    set :deploy_to, "C:/builds/" 
    set :use_sudo, false 
    namespace :tomcat do 
     task :deploy do 
     puts "==================Building with Maven======================" #Line 22 
     run "export JAVA_HOME=#{java_home} && cd #{deploy_to}/ && #{maven_home}/bin/mvn clean install package -DskipTests" 
     puts "==================Undeploy war======================"#Line 24 
     run "curl --user #{tomcat_manager}:#{tomcat_manager_password} http://$CAPISTRANO:HOST$:8080/manager/text/undeploy?path=/#{application}" 
     puts "==================Deploy war to Tomcat======================" #Line 26 
     run "curl --upload-file #{deploy_to}/current/target/dist/local/#{application}*.war --user #{tomcat_manager}:#{tomcat_manager_password} http://$CAPISTRANO:HOST$:8080/manager/text/deploy?path=/#{application}" 
     end 
    end 
    after "deploy", "tomcat:deploy" #Line 30 
    after "tomcat:deploy", "deploy:cleanup" # keep only the last 5 releases 
end 

回答

0

ECONNREFUSEDconnect(2)系統調用的返回。這意味着服務器進程不會偵聽TCP端口8080. Java需要一些時間才能啓動,並且您可能嘗試通過curl過早連接,或者您尚未配置Tomcat以偵聽端口8080,或者您根本沒有啓動Tomcat 。