Почему не удаётся задеплоить war файл на Tomcat 8 через Maven?

Есть JSF-проект. Необходимо его запустить на сервере Tomcat 8.
Написал POM:
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>alexiuscrow</groupId>
  <artifactId>LabJSF</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>LabJSF</name>
  
  <dependencies>
  	<dependency>
      <groupId>org.apache.myfaces.core</groupId>
      <artifactId>myfaces-api</artifactId>
      <version>2.2.6</version>
    </dependency>
  </dependencies>
  
  <build>
    <sourceDirectory>JavaSource</sourceDirectory>
    <finalName>LabJSF</finalName>
    
    <resources>
      <resource>
        <directory>JavaSource</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </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>/jsflearning</path>
		</configuration>
	</plugin>
	
    </plugins>
  </build>
  
</project>

вычитал, что подключённый плагин для tomacat 7 по идее должен работать и под tomacat 8.

В %TOMCAT7_PATH%/conf/tomcat-users.xml прописал:
<?xml version='1.0' encoding='cp1251'?>

<tomcat-users xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">

	<role rolename="manager-gui"/>
	<role rolename="admin-gui"/>
	<role rolename="manager-script"/>
	<role rolename="manager"/>
	<user username="admin" password="password" roles="manager-gui,admin-gui,mmanager-script,manager" />
	
</tomcat-users>

... и в %MAVEN_PATH%/conf/settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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">
...
  <servers>
    <server>
      	<id>TomcatServer</id>
      	<username>admin</username>
      	<password>password</password>
    </server>
  </servers>
...
</settings>

но в результете получил:
[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 LabJSF 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) @ LabJSF >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ LabJSF ---
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ LabJSF ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ LabJSF ---
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\alexiuscrow\workspace\LabJSF\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ LabJSF ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ LabJSF ---
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) @ LabJSF ---
[INFO] Packaging webapp
[INFO] Assembling webapp [LabJSF] in [D:\alexiuscrow\workspace\LabJSF\target\LabJSF]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\alexiuscrow\workspace\LabJSF\WebContent]
[INFO] Webapp assembled in [1995 msecs]
[INFO] Building war: D:\alexiuscrow\workspace\LabJSF\target\LabJSF.war
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) @ LabJSF <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ LabJSF ---
[INFO] Deploying war to localhost:8080/jsflearning
Uploading: localhost:8080/manager/text/deploy?path=%2Fjsflearning

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: localhost:8080/manager/text/deploy?path=%2Fjsflearning

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: localhost:8080/manager/text/deploy?path=%2Fjsflearning

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: localhost:8080/manager/text/deploy?path=%2Fjsflearning

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.470 s
[INFO] Finished at: 2014-12-21T11:38:47+02:00
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project LabJSF: Cannot invoke Tomcat manager: Connection reset by peer: socket write error -> [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] cwiki.apache.org/confluence/display/MAVEN/MojoExec...

В чём может быть проблема и как её исправить?
P.S. Для того, что бы изменить место логкального репозитория в %MAVEN_PATH%/conf/settings.xml пытался прописать:
<?xml version="1.0" encoding="UTF-8"?>
<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>D:\alexiuscrow\mvn-repo</localRepository>
...
</settings>

но результат остался прежний (${user.home}/.m2/repository).
Вполне логичным предположением будет то что проблемы с деплоем через maven и сменой локального репозитория связаны с тем, что maven по какой-то причине "не видит" файл %MAVEN_PATH%/conf/settings.xml . Почему так происходит?
  • Вопрос задан
  • 7809 просмотров
Решения вопроса 1
Alexiuscrow
@Alexiuscrow Автор вопроса
Проблема решена.
В файле %TOMCAT7_PATH%/conf/tomcat-users.xml была допущена ошибка в строке
...
<user username="admin" password="password" roles="manager-gui,admin-gui,mmanager-script,manager" />
...

1 лишняя буква "m" в "manager-script"
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
@Power
Такое ощущение, что у вас томкат не запущен или запущен не на порту 8080.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы