작성
·
368
0
올려주신 파일을 git clone하고 제 레포지토리에서 생성한다음 jenkins configure 에서 github repository url을 제 레포지토리로 변경하였더니
MockHttpServletRequest:
HTTP Method = GET
Request URI = /
Parameters = {}
Headers = []
Body = <no character encoding set>
Session Attrs = {}
Handler:
Type = com.njonecompany.web.controller.WelcomeController
Method = com.njonecompany.web.controller.WelcomeController#index(Model)
Async:
Async started = false
Async result = null
Resolved Exception:
Type = null
ModelAndView:
View name = index
View = null
Attribute = msg
value = Hi, there
Attribute = today
value = Thu Nov 23 03:03:16 UTC 2023
FlashMap:
Attributes = null
MockHttpServletResponse:
Status = 200
Error message = null
Headers = [Content-Language:"en"]
Content type = null
Body =
Forwarded URL = /WEB-INF/views/index.jsp
Redirected URL = null
Cookies = []
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.345 s - in com.njonecompany.web.TestWelcome
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-war-plugin:3.2.2:war (default-war) @ web ---
[INFO] Packaging webapp
[INFO] Assembling webapp [web] in [/var/jenkins_home/workspace/My-Third-Project/target/hello-world]
[INFO] Processing war project
[INFO] Copying webapp resources [/var/jenkins_home/workspace/My-Third-Project/src/main/webapp]
[INFO] Webapp assembled in [56 msecs]
[INFO] Building war: /var/jenkins_home/workspace/My-Third-Project/target/hello-world.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.167 s
[INFO] Finished at: 2023-11-23T03:03:18Z
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /var/jenkins_home/workspace/My-Third-Project/pom.xml to com.njonecompany.web/web/1.0/web-1.0.pom
[JENKINS] Archiving /var/jenkins_home/workspace/My-Third-Project/target/hello-world.war to com.njonecompany.web/web/1.0/web-1.0.war
channel stopped
[DeployPublisher][INFO] Attempting to deploy 1 war file(s)
[DeployPublisher][INFO] Deploying /var/jenkins_home/workspace/My-Third-Project/target/hello-world.war to container Tomcat 9.x Remote with context null
ERROR: Build step failed with exception
org.codehaus.cargo.container.ContainerException: Failed to redeploy [/var/jenkins_home/workspace/My-Third-Project/target/hello-world.war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:176)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:81)
at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167)
at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136)
at hudson.FilePath.act(FilePath.java:1198)
at hudson.FilePath.act(FilePath.java:1181)
at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133)
at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:47)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:818)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:767)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1072)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:711)
at hudson.model.Run.execute(Run.java:1925)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/java.net.Socket.connect(Socket.java:558)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:509)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:604)
at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:277)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:376)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:397)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1253)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:567)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:882)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:895)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:161)
... 19 more
java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/java.net.Socket.connect(Socket.java:558)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:509)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:604)
at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:277)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:376)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:397)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1253)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:567)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:882)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:895)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:161)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:81)
at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167)
at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136)
at hudson.FilePath.act(FilePath.java:1198)
at hudson.FilePath.act(FilePath.java:1181)
at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133)
at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:47)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:818)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:767)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1072)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:711)
at hudson.model.Run.execute(Run.java:1925)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Build step 'Deploy war/ear to a container' marked build as failure
Finished: FAILURE
이렇게 나옵니다. Caused by
java.net.ConnectException: Connection refused (Connection refused)
이렇게 나오는데 어떻게 해결해야 할까요??
레포지토리 주소는 이렇게 옮겨놓았습니다!
답변 1
0
안녕하세요, 인프런 AI 인턴입니다.
Jenkins에서 귀하의 GitHub 레포지토리 주소로 변경 후 빌드가 실패하고, java.net.ConnectException: Connection refused
오류가 발생한 것으로 보입니다. 이 문제를 해결하려면 다음과 같은 단계를 확인해 보실 필요가 있습니다:
Jenkins가 배포를 시도하는 서버의 호스트와 포트가 정확한지 확인해주세요. 오류 메시지에서 Jenkins가 Tomcat 서버에 연결하려고 시도했으나, 연결이 거부되었다는 메시지가 나타나고 있습니다. 이는 Jenkins가 배포하려는 서버(Tomcat)가 제대로 실행되고 있지 않거나, 네트워크 문제, 또는 호스트와 포트 설정이 잘못되었을 가능성이 있습니다.
Tomcat 서버의 관리자 계정(manager-script
역할이 있는 사용자)의 username과 password가 Jenkins의 배포 설정(Cargo plugin 설정)과 일치하는지 확인해주세요.
방화벽 설정이나 기타 네트워크 보안 설정으로 인해 Jenkins 서버에서 Tomcat 서버로의 접속이 막히지 않았는지도 확인해 보세요.
Tomcat 서버의 로그를 확인하여 추가적인 오류 메시지나 정보를 찾아보세요.
또한 확인하신 이미지에는 ‘Credentials’ 항목이 ‘- none -‘으로 설정되어 있어 인증 정보가 없는 상태로 Git 레포지토리에 접근하고 있습니다. 레포지토리가 비공개일 경우 적절한 인증 정보가 필요할 수 있습니다. 필요한 인증 정보를 설정해주시길 바랍니다.
이미지에서 보여지는 대로, 레포지토리 주소는 https://github.com/juhoon212/jenkins-study.git
로 잘 설정된 것 같습니다. 그러나 위에 언급한 다른 설정들도 함께 확인해보셔야 할 것 같습니다.
더 자세한 진단을 위해서는 Jenkins 설정과 Tomcat 서버 설정, 두 서버 간의 네트워크 연결상태 등을 좀 더 꼼꼼히 살펴보시기 바랍니다.