I want to deploy Maven based war file to Tomcat.
Technologies used :
Maven 3.1.1
Eclipse 4.2
JDK 7
Spring 4.1.1.RELEASED
Tomcat 7
Logback 1.0.13
I have this plugin in my maven file:
<!-- For Maven Tomcat Plugin -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/DevicesCloudWebApp</path>
<username>admin</username>
<password>admin</password>
<update>true</update>
</configuration>
</plugin>
but when I deploy using the command mvn tomcat7:deploy
I have this error:
[DEBUG] Connection 0.0.0.0:62265<->127.0.0.1:8080 closed
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package # DevicesCloudWebApp >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # DevicesCloudWebApp ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # DevicesCloudWebApp ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # DevicesCloudWebApp ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # DevicesCloudWebApp ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # DevicesCloudWebApp ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # DevicesCloudWebApp ---
[INFO] Packaging webapp
[INFO] Assembling webapp [DevicesCloudWebApp] in [/Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/target/DevicesCloudWebApp]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/src/main/webapp]
[INFO] Webapp assembled in [97 msecs]
[INFO] Building war: /Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/target/DevicesCloudWebApp.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package # DevicesCloudWebApp <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) # DevicesCloudWebApp ---
[INFO] Deploying war to http://localhost:8080/DeviceslCloudWebApp
Uploading: http://localhost:8080/manager/text/deploy?path=%2FDeviceslCloudWebApp
2170/6062 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2FDeviceslCloudWebApp
2198/6062 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2FDeviceslCloudWebApp
2176/6062 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2FDeviceslCloudWebApp
2188/6062 KB
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.922 s
[INFO] Finished at: 2016-12-02T20:57:29+01:00
[INFO] Final Memory: 16M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project DevicesCloudWebApp: Cannot invoke Tomcat manager: Broken pipe -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Try adding authentication configuration like below
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat7-maven-plugin.version}</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>tomcat</server>
<username>admin1</username>
<password>admin1</password>
<path>/${project.artifactId}</path>
<update>true</update>
</configuration>
</plugin>
Update the role configuration like below in the tomcat -> $CATALINA_HOME/conf/tomcat-users.xml in <tomcat-users> element
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
<user username="admin1" password="admin1" roles="manager-script"/>
Related
so i have been trying to deploy my spring microservices using jib and it has been really fustrating :(
I have been jumping from one issue to another and right now i dont how to get out of this present situation... I have used openjdk 17 alphine and this is the logs i get from my build...
PS C:\xampp\htdocs\weddingapp-main\weddingapp> mvn clean compile jib:build -rf :discovery-service [INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] discovery-service [jar]
[INFO] api-gateway [jar]
[INFO] wedding [jar]
[INFO] users [jar]
[INFO]
[INFO] -----------------< com.slinkdigital:discovery-service >-----------------
[INFO] Building discovery-service 1.0-SNAPSHOT [1/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # discovery-service ---
[INFO] Deleting C:\xampp\htdocs\weddingapp-main\weddingapp\discovery-service\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # discovery-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # discovery-service ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\xampp\htdocs\weddingapp-main\weddingapp\discovery-service\target\classes
[INFO]
[INFO] --- jib-maven-plugin:3.3.0:build (default-cli) # discovery-service ---
[INFO]
[INFO] Containerizing application to registry.hub.docker.com/davidtega/discovery-service...
[INFO] Using credentials from Maven settings file for registry.hub.docker.com/davidtega/discovery-service
[INFO]
[INFO] Container entrypoint set to [java, -cp, #/app/jib-classpath-file, com.slinkdigital.eureka.DiscoveryServiceApplication]
[WARNING] PATCH https://registry.hub.docker.com/v2/davidtega/discovery-service/blobs/uploads/79257277-0299-4f05-90cc-e33f34d3a44a?_state=P1UgMi0NjbwAR3C9mu77RBBM0P2yRJNUC5Qz-wEGppl7Ik5hbWUiOiJkYXZpZHRlZ2EvZGlzY292ZXJ5LXNlcnZpY2UiLCJVVUlEIjoiNzkyNTcyNzctMDI5OS00ZjA1LTkwY2MtZTMzZjM0ZDNhNDRhIiwiT2Zmc2V0IjowLCJTdGFydGVkQXQiOiIyMDIyLTEwLTEyVDA0OjMyOjU2Ljg4OTcxNzc4OFoifQ%3D%3D failed and will NOT be retried
[ERROR] I/O error for image [registry.hub.docker.com/davidtega/discovery-service]:
[ERROR] java.net.SocketException
[ERROR] An established connection was aborted by the software in your host machine
[INFO] Executing tasks:
[INFO] [======================= ] 77.8% complete
[INFO] > launching layer pushers
[INFO] > scheduling pushing manifests
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for discovery-service 1.0-SNAPSHOT:
[INFO]
[INFO] discovery-service .................................. FAILURE [32:57 min]
[INFO] api-gateway ........................................ SKIPPED
[INFO] wedding ............................................ SKIPPED
[INFO] users .............................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32:58 min
[INFO] Finished at: 2022-10-12T06:05:32+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.3.0:build (default-cli) on project discovery-service: An established connection was aborted by the software in your host machine -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I have restarted my pc severally, cleaned up my config.json file and tried every other solution i have seen but its still not working, i will appreciate the assistance... Thanks
I want to start spring-boot maven application in debug mode in intellij Idea, but when I make breakpoints the application doesn't suspend and goes further. I've read a lot of topics but I still don't understand how to do it. Could you help me decide the best course of action.
Edit: I use spring-boot-maven-plugin and Maven Run/Debug configuration with spring-boot:run in command line.
Edit: So when I added Jvm Arguments to pom.xml I recieved such log:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building shop 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) > test-compile # shop >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # shop ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # shop ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # shop ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Валера\IdeaProjects\shop\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # shop ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) < test-compile # shop <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) # shop ---
[INFO] Attaching agents: []
Listening for transport dt_socket at address: 5005
But when requesting localhost:5005/myPage I recieve Error 101 (net: : ERR_CONNECTION_RESET). Seems like some maven arguments did not specify.
Here my maven plagin in pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Xdebug - Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
</jvmArguments>
</configuration>
</plugin>
</plugins>
</build>
In your Run/Debug Configurations enter the following into your command line:
spring-boot:run -Dspring.profiles.active=local,<mine> -Dfork=false -f pom.xml
My Maven spring-boot:run configuration debugs just fine with the -D fork=false added.
You may use below command in the CLI:
export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n
Below is my project settings:
enter image description here
I am using eclipse Luna + maven 3.2 . I have developed small application and trying to move to console.developers.google.com using mvn:appengine:devserver .
But i am getting build failure . below is the error .
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> appengine-maven-plugin:1.9.32:devserver (default-cli) > package # helloworld >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory F:\googleAppEngine\helloworld\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # helloworld ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory F:\googleAppEngine\helloworld\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # helloworld ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # helloworld ---
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) # helloworld ---
[INFO] Packaging webapp
[INFO] Assembling webapp [helloworld] in [F:\googleAppEngine\helloworld\target\helloworld-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp webResources [F:\googleAppEngine\helloworld/src/main/webapp/WEB-INF] to [F:\googleAppEngine\helloworld\target\helloworld-1.0-SNAPSHOT]
[INFO] Copying webapp resources [F:\googleAppEngine\helloworld\src\main\webapp]
[INFO] Webapp assembled in [121 msecs]
[INFO] Building war: F:\googleAppEngine\helloworld\target\helloworld-1.0-SNAPSHOT.war
[INFO]
[INFO] <<< appengine-maven-plugin:1.9.32:devserver (default-cli) < package # helloworld <<<
[INFO]
[INFO] --- appengine-maven-plugin:1.9.32:devserver (default-cli) # helloworld ---
[INFO]
[INFO] Google App Engine Java SDK - Running Development Server
[INFO]
[INFO] Retrieving Google App Engine Java SDK from Maven
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.016 s
[INFO] Finished at: 2016-03-09T08:14:33+05:30
[INFO] Final Memory: 15M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.appengine:appengine-maven-plugin:1.9.32:devserver (default-cli) on project helloworld: Execution default-cli of goal com.google.appengine:appengine-maven-plugin:1.9.32:devserver failed. NoSuchElementException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
I'm getting an error trying to deploy the CLIFF .war to my tomcat7 server.
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:deploy (default-cli) on project cliff: Cannot invoke Tomcat manager: Connection to http://localhost:8080 refused: Connection refused
OS X 10.10.5
Apache Tomcat/8.0.24
JVM 1.8.0_05-b13
David-Laxers-MacBook-Pro:CLIFF davidlaxer$ mvn -version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T09:37:52-08:00)
Maven home: /Users/davidlaxer/Downloads/apache-maven-3.2.1
Java version: 1.8.0_05, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"
David-Laxers-MacBook-Pro:CLIFF davidlaxer$
David-Laxers-MacBook-Pro:CLIFF davidlaxer$ sudo mvn tomcat7:deploy -DskipTests
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] CLIFF
[INFO] common
[INFO] stanford-entity-extractor
[INFO] cliff
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building CLIFF 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # CLIFF >>>
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) # CLIFF <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) # CLIFF ---
[INFO] Skipping non-war project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building common 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # common >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/common/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # common ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/common/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # common ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) # common ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # common ---
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) # common <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) # common ---
[INFO] Skipping non-war project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building stanford-entity-extractor 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # stanford-entity-extractor >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # stanford-entity-extractor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 14 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # stanford-entity-extractor ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # stanford-entity-extractor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 23 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # stanford-entity-extractor ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) # stanford-entity-extractor ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # stanford-entity-extractor ---
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) # stanford-entity-extractor <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) # stanford-entity-extractor ---
[INFO] Skipping non-war project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building cliff 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # cliff >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # cliff ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 12 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # cliff ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # cliff ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/webapp/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # cliff ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) # cliff ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # cliff ---
[INFO] Packaging webapp
[INFO] Assembling webapp [cliff] in [/Users/davidlaxer/CLIFF/webapp/target/cliff-2.3.0]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/davidlaxer/CLIFF/webapp/src/main/webapp]
[INFO] Webapp assembled in [1345 msecs]
[INFO] Building war: /Users/davidlaxer/CLIFF/webapp/target/cliff-2.3.0.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) # cliff <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) # cliff ---
[INFO] Deploying war to http://localhost:8080/cliff-2.3.0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] CLIFF ............................................. SUCCESS [ 1.728 s]
[INFO] common ............................................ SUCCESS [ 1.883 s]
[INFO] stanford-entity-extractor ......................... SUCCESS [ 0.265 s]
[INFO] cliff ............................................. FAILURE [ 11.384 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.717 s
[INFO] Finished at: 2015-08-26T08:07:32-08:00
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:deploy (default-cli) on project cliff: Cannot invoke Tomcat manager: Connection to http://localhost:8080 refused: Connection refused -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ConnectException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :cliff
pom.xml:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<server>CliffTomcatServer</server>
<path>/${project.build.finalName}</path>
</configuration>
</plugin>
~/.m2/settings.xml:
<server>
<id>CliffTomcatServer</id>
<username>cliff</username>
<password>beer</password>
</server>
/usr/local/apache-tomcat-8.0.24/conftomcat_users.xml:
<tomcat-users>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="cliff" password="beer" roles="manager,manager-gui,manager-script"/>
Added to pom.xlm: http://localhost:8080/manager/text
[INFO] Deploying war to http://localhost:8080/cliff-2.3.0
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2052/127150 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2356/127150 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2052/127150 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2156/127150 KB
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] CLIFF ............................................. SUCCESS [ 1.523 s]
[INFO] common ............................................ SUCCESS [ 1.718 s]
[INFO] stanford-entity-extractor ......................... SUCCESS [ 0.359 s]
[INFO] cliff ............................................. FAILURE [ 12.664 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.735 s
[INFO] Finished at: 2015-08-26T11:04:23-08:00
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:deploy (default-cli) on project cliff: Cannot invoke Tomcat manager: Broken pipe -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :cliff
David-Laxers-MacBook-Pro:CLIFF davidlaxer$
When I set in the ~/.m2/settings.xml,it does not work. So I set in the pom.xml,like this:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat7-maven-plugin.version}</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>tomcat</server>
<username>admin1</username>
<password>admin1</password>
<path>/${project.artifactId}</path>
<update>true</update>
</configuration>
</plugin>
And in $CATALINA_HOME/conf/tomcat-users.xml file, in <tomcat-users> element, add as follows:
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
<user username="admin1" password="admin1" roles="manager-script"/>
Then it works for me. :)
The role for deploying on /manager/text is "manager-script" and the Apache Tomcat Manager How-To indicates it shouldn't be applied to a user with the manager-gui role. I use a deployment user with only the manager-script role and no others, and that uploads the WAR file fine without the broken pipe message. If I add the manager-gui role to my deployment user, I get the broken pipe message you encounter. Try changing your tomcat-users.xml to limit Cliff's role to the single manager-script role. Hope it helps.
http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html
You may need to add this
<configuration>
..
<update>true</update>
..
</configuration>
to your pom.xml file to run
mvn tomcat7:deploy
I got this error when running mvn tomcat7:deploy instead of mvn tomcat7:redeploy.
If you're running CentOS, you may need to install additional management libraries:
yum install tomcat-webapps tomcat-admin-webapps
On other platforms solution may be similar.
I haven't been able to use the mvn redeploy shortcut since I merged in the code that split it into a few mvn modules. I recommend copying the .war file from webapp/target to the tomcat webapps dir on your computer/server.
May be you should check the webapps/manager/WEB-INF/web.xml file to ensure your .war file is smaller than the configured value.
<max-file-size>152428800</max-file-size>
<max-request-size>152428800</max-request-size>
See this question: IBM MobileFirst Platform 6.3 Operational Analytics Failed installation for Tomcat
if you already have the same application deploy on the tomcat server you need to undeploy it first. If you deploy it again it can give your the connection error.
I'm trying to deploy my web app on Tomcat 7 with Maven (version 3.2.1), but getting exception listed in the title.
I've tried following solutions from questions (tomcat:deploy: "Cannot invoke Tomcat manager: Connection refused", Tomcat deployement issue in a Maven project):
Use tomcat user with manager-script role (respectfully edited settings.xml, pom.xml, tomcat-users.xml)
Deploy without specifying tomcat user.
Use diff maven commands e.g.: clean install tomcat7:deploy, clean tomcat7:deploy, tomcat7:redeploy, tomcat7:redeploy-only.
Also I should mention that if I'm running app on server without maven i.e. Project > Run As > Run on Server or using maven tomcat7-run goals i.e. clean install tomcat7:run then it all works as fine.
This is how I edit settings.xml, pom.xml, tomcat-users.xml when using tomcat user.
tomcat-users.xml:
<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="user" password="pass" roles="manager-script"></user>
</tomcat-users>
settings.xml:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<usePluginRegistry>false</usePluginRegistry>
<offline>false</offline>
<servers>
<server>
<id>apache-tomcat-7</id>
<username>user</username>
<password>pass</password>
</server>
</servers>
</settings>
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example.company</groupId>
<artifactId>magazine</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>market Maven Webapp</name>
<url>http://maven.apache.org</url>
<build>
<finalName>${project.artifactId}</finalName>
<outputDirectory>${CATALINA_HOME}/webapps/${project.artifactId}/${project.artifactId}</outputDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>apache-tomcat-7</server>
<url>http://localhost:8080/manager/text</url>
<path>/${project.artifactId}</path>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</build>
...//dependencies
</project>
EDIT:
My Maven output with goals clean install tomcat7:deploy -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building market Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # magazine ---
[INFO] Deleting D:\git\magazine\target
[INFO] Deleting D:\EclipseWorkspace\apache-tomcat-7.0.59\webapps\magazine\magazine
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # magazine ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # magazine ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 19 source files to D:\EclipseWorkspace\apache-tomcat-7.0.59\webapps\magazine\magazine
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # magazine ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\git\magazine\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # magazine ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # magazine ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) # magazine ---
[INFO] Packaging webapp
[INFO] Assembling webapp [magazine] in [D:\git\magazine\target\magazine]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\git\magazine\src\main\webapp]
[INFO] Webapp assembled in [376 msecs]
[INFO] Building war: D:\git\magazine\target\magazine.war
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # magazine ---
[INFO] Installing D:\git\magazine\target\magazine.war to C:\Users\Mark\.m2\repository\ua\khpi\norkin\magazine\0.0.1-SNAPSHOT\magazine-0.0.1-SNAPSHOT.war
[INFO] Installing D:\git\magazine\pom.xml to C:\Users\Mark\.m2\repository\ua\khpi\norkin\magazine\0.0.1-SNAPSHOT\magazine-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) # magazine >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # magazine ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # magazine ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # magazine ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\git\magazine\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # magazine ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # magazine ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) # magazine ---
[INFO] Packaging webapp
[INFO] Assembling webapp [magazine] in [D:\git\magazine\target\magazine]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\git\magazine\src\main\webapp]
[INFO] Webapp assembled in [221 msecs]
[INFO] Building war: D:\git\magazine\target\magazine.war
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) # magazine <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) # magazine ---
[INFO] Deploying war to http://localhost:8080/magazine
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.622 s
[INFO] Finished at: 2015-03-08T11:09:46+02:00
[INFO] Final Memory: 25M/221M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project magazine: Cannot invoke Tomcat manager: Connection refused: connect -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project magazine: Cannot invoke Tomcat manager
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot invoke Tomcat manager
at org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:141)
at org.apache.tomcat.maven.plugin.tomcat7.AbstractWarCatalinaMojo.execute(AbstractWarCatalinaMojo.java:68)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.tomcat.maven.common.deployer.TomcatManager.invoke(TomcatManager.java:742)
at org.apache.tomcat.maven.common.deployer.TomcatManager.deployImpl(TomcatManager.java:705)
at org.apache.tomcat.maven.common.deployer.TomcatManager.deploy(TomcatManager.java:388)
at org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployWarMojo.deployWar(AbstractDeployWarMojo.java:85)
at org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployMojo.invokeManager(AbstractDeployMojo.java:82)
at org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:132)
... 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Also there is no log file in ${CATALINA_HOME}/logs - what I have is empty folder.
Besides there is no ${project.dir}/target/tomcat folder that I observed before.
Also should this option be checked ?