작성
·
1.1K
0
Started by user doradorav
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/myThird-project
The recommended git tool is: NONE
No credentials specified
> git rev-parse --resolve-git-dir /var/jenkins_home/workspace/myThird-project/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/joneconsulting/cicd-web-project # timeout=10
Fetching upstream changes from https://github.com/joneconsulting/cicd-web-project
> git --version # timeout=10
> git --version # 'git version 2.30.2'
> git fetch --tags --force --progress -- https://github.com/joneconsulting/cicd-web-project +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/main^{commit} # timeout=10
Checking out Revision c1def65d0b6e92459ac070482924b26aeb1aae38 (refs/remotes/origin/main)
> git config core.sparsecheckout # timeout=10
> git checkout -f c1def65d0b6e92459ac070482924b26aeb1aae38 # timeout=10
Commit message: "Update index.jsp"
> git rev-list --no-walk c1def65d0b6e92459ac070482924b26aeb1aae38 # timeout=10
Parsing POMs
Established TCP socket on 44853
[myThird-project] $ java -cp /var/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.14.jar:/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3.9.6/boot/plexus-classworlds-2.6.0.jar:/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3.9.6/conf/logging jenkins.maven3.agent.Maven35Main /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3.9.6 /var/jenkins_home/war/WEB-INF/lib/remoting-3107.v665000b_51092.jar /var/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.14.jar /var/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.14.jar 44853
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /var/jenkins_home/workspace/myThird-project/pom.xml clean compile package
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.njonecompany.web:web >----------------------
[INFO] Building cicd-web-project maven webapp 1.0
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ web ---
[INFO] Deleting /var/jenkins_home/workspace/myThird-project/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ web ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ web ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /var/jenkins_home/workspace/myThird-project/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ web ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ web ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ web ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/jenkins_home/workspace/myThird-project/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ web ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /var/jenkins_home/workspace/myThird-project/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ web ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.njonecompany.web.TestWelcome
05:10:51,587 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
05:10:51,587 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
05:10:51,587 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/var/jenkins_home/workspace/myThird-project/target/classes/logback.xml]
05:10:51,640 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
05:10:51,640 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
05:10:51,643 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
05:10:51,670 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead.
05:10:51,670 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
05:10:51,670 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
05:10:51,671 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.njonecompany.web] to DEBUG
05:10:51,671 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.njonecompany.web] to false
05:10:51,671 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[com.njonecompany.web]
05:10:51,671 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
05:10:51,671 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
05:10:51,671 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
05:10:51,671 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5fb759d6 - Registering current configuration as safe fallback point
2023-07-26 05:10:52 [main] DEBUG c.n.web.controller.WelcomeController - Welcome to njonecompany.com...
Wed Jul 26 05:10:52 UTC 2023
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 = Wed Jul 26 05:10:52 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: 0.684 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/myThird-project/target/hello-world]
[INFO] Processing war project
[INFO] Copying webapp resources [/var/jenkins_home/workspace/myThird-project/src/main/webapp]
[INFO] Webapp assembled in [43 msecs]
[INFO] Building war: /var/jenkins_home/workspace/myThird-project/target/hello-world.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.141 s
[INFO] Finished at: 2023-07-26T05:10:54Z
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /var/jenkins_home/workspace/myThird-project/pom.xml to com.njonecompany.web/web/1.0/web-1.0.pom
[JENKINS] Archiving /var/jenkins_home/workspace/myThird-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/myThird-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/myThird-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:507)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:602)
at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:275)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:374)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:395)
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:507)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:602)
at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:275)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:374)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:395)
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
이거 아예안되어서 8시간동안 고쳐볼라했는데 아침부터 밤이될때까지 못했어요 ㅠㅠㅠㅠㅠ
답변 1
1
안녕하세요, 이도원입니다.
올려주신 이미지를 확인해 보면, Jenkins 서버를 접속할 때, localhost를 사용하셨고, Tomcat 서버의 접속 주소도 http://localhost:9090으로 설정 하셨습니다. 에러메시지를 보면, war파일로 패키징 된 결과물이 Tomcat 서버로 배포를 시도할 때, 서버하고의 접속이(Connection refused) 되지 않는 것 같습니다. 설정하신 내용처럼, Jenkins서버와 Tomcat 서버가 같은 주소인지 확인해 보셔야 할 것 같습니다. Tomcat 서버가 MacOS에서 localhost:9090 으로 접속이 가능한 상태라고 하더라도, Jenkins 내에서도 localhost:9090으로 접속이 되지 않을 수 있습니다. Jenkins에서 Deployer 플러그인을 통해 배포하는 작업은 Jenkins와 Tomcat 서버 간의 통신이기 때문에, Jenkins 서버와 Tomcat서버가 같은 서버로 설치되지 않은 이상 localhost로 접속할 수 없습니다.
아래 이미지 처럼, localhost 대신 Tomcat 서버의 IP를 입력하여 배포를 다시 해 보시기 바랍니다. Jenkins 및 Tomcat 서버의 IP는 2개의 서비스 모두 Docker로 기동되었다고 가정하고, docker network inspect 명령어로 확인하실 수 있습니다.
위 내용으로 설정 문제가 해결 되지 않으면, 작업(또는 실행)하신 환경을 공유해 주시면, 다른 해결책을 찾아보도록 하겠습니다.
감사합니다.