작성
·
2.1K
0
강의 내용대로 jenkins는 container를 사용하여 띄웠고, tomcat 설치는 section8의 tomcat 설정법 그대로 따라하였습니다. 그러나 계속 "Build step 'Deploy war/ear to a container' marked build as failure" 라는 Console output결과가 확인 되며 배포가 되지 않습니다.. tomcat의 주소는 127.0.0.1:8088로 설정하였습니다. 아래는 console output 전문입니다.
Started by user 박재범 Running as SYSTEM Building in workspace /var/jenkins_home/workspace/my-third-project The recommended git tool is: NONE No credentials specified Cloning the remote Git repository Cloning repository https://github.com/joneconsulting/cicd-web-project > git init /var/jenkins_home/workspace/my-third-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 config remote.origin.url https://github.com/joneconsulting/cicd-web-project # timeout=10 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 Avoid second fetch > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision 73ccc1c190255fc0bcc6cc55d777bfc4a98b44ee (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 73ccc1c190255fc0bcc6cc55d777bfc4a98b44ee # timeout=10 Commit message: "changed the index.jsp file" First time build. Skipping changelog. Parsing POMs Discovered a new module com.njonecompany.web:web cicd-web-project maven webapp Modules changed, recalculating dependency graph Established TCP socket on 36461 [my-third-project] $ java -cp /var/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3.8.6/boot/plexus-classworlds-2.6.0.jar:/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3.8.6/conf/logging jenkins.maven3.agent.Maven35Main /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3.8.6 /var/jenkins_home/war/WEB-INF/lib/remoting-3044.vb_940a_a_e4f72e.jar /var/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /var/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar 36461 <===[JENKINS REMOTING CAPACITY]===>channel started Executing Maven: -B -f /var/jenkins_home/workspace/my-third-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/my-third-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/my-third-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/my-third-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/my-third-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 09:12:19,302 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 09:12:19,302 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 09:12:19,302 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/var/jenkins_home/workspace/my-third-project/target/classes/logback.xml] 09:12:19,338 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 09:12:19,338 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 09:12:19,341 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT] 09:12:19,364 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead. 09:12:19,364 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder. 09:12:19,364 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details 09:12:19,364 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.njonecompany.web] to DEBUG 09:12:19,364 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.njonecompany.web] to false 09:12:19,364 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[com.njonecompany.web] 09:12:19,364 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR 09:12:19,364 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT] 09:12:19,365 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 09:12:19,365 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6e2aa843 - Registering current configuration as safe fallback point 2022-09-30 09:12:19 [main] DEBUG c.n.web.controller.WelcomeController - Welcome to njonecompany.com... Fri Sep 30 09:12:19 UTC 2022 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 = Fri Sep 30 09:12:19 UTC 2022 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.451 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 [21 msecs] [INFO] Building war: /var/jenkins_home/workspace/my-third-project/target/hello-world.war [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.679 s [INFO] Finished at: 2022-09-30T09:12:21Z [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 [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:1192) at hudson.FilePath.act(FilePath.java:1175) 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:816) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:765) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1072) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:709) at hudson.model.Run.execute(Run.java:1924) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:107) at hudson.model.Executor.run(Executor.java:449) 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:508) at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603) at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:276) at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:375) at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:396) 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:508) at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603) at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:276) at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:375) at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:396) 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:1192) at hudson.FilePath.act(FilePath.java:1175) 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:816) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:765) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1072) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:709) at hudson.model.Run.execute(Run.java:1924) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:107) at hudson.model.Executor.run(Executor.java:449) Build step 'Deploy war/ear to a container' marked build as failure Finished: FAILURE
도움 주시면 정말 감사하겠습니다!
답변 2
1
해결했습니다! container로도 tomcat을 띄워보고 시도해봤지만 결국 지금 제가 사용하고 있는 Ip주소를 jenkins 내에서 입력하니 해결되었습니다. 감사합니다!
0
안녕하세요, 이도원입니다.
보내주신 에러 메시지는 확인해 보나, Maven 빌드까지는 잘 된 것 같은데, 빌드된 war 파일이 Tomcat 서버로 전송될 때 오류가 발생 한 것 같습니다. Tomcat 서버를 Host PC에 설치할 때 배포를 위한 사용자 계정을 추가하고 적절한 권한 설정이 필요합니다. 아래 정보와 같이 해당 설정이 되어 있는지 확인해 보시기 바랍니다. 참고로 Tomcat 서버는 9.x 버전이나 8.x 버전으로 설치해서 사용하시기 바랍니다.
%TOMCAT_HOME%/webapps/manager/META-INF/context.xml 파일 수정
%TOMCAT_HOME%/webapps/host-manager/META-INF/context.xml 파일 수정
%TOMCAT_HOME%/conf/tomcat-users.xml 파일 수정
감사합니다.