Eclipse 无法执行目标tomcat:deploy写入服务器时出错

Eclipse 无法执行目标tomcat:deploy写入服务器时出错,eclipse,apache,maven,tomcat7,Eclipse,Apache,Maven,Tomcat7,我正在尝试测试SpringMVC教程 我想使用EclipseMaven在Tomcat7上部署生成的war 在tomcat上手动部署时,war工作正常 应采取的步骤: 在eclipse上导入项目 将此插件添加到现有POM: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifa

我正在尝试测试SpringMVC教程

我想使用EclipseMaven在Tomcat7上部署生成的war

在tomcat上手动部署时,war工作正常

应采取的步骤:

  • 在eclipse上导入项目
  • 将此插件添加到现有POM:

    <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>tomcat-maven-plugin</artifactId>
                <version>1.1</version>
                <configuration>
                    <mode>war</mode>
                    <url>http://localhost:8080/manager/html/</url>
                    <server>TomcatServer</server>
                    <path>/springexample</path>
                  </configuration>
    
    
    org.codehaus.mojo
    


    你应该把精力集中在

    Caused by: java.io.IOException: Error writing to server 
    at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) 
    at org.codehaus.mojo.tomcat.TomcatManager.invoke(TomcatManager.java:604)
    
    查看TomcatManager()的源代码

    maven插件无法从服务器读取数据。它连接(第597行),写入数据(第601行),但在读取响应(第604行)时失败


    我会先尝试在服务器上部署(以消除网络问题),看看问题是否仍然存在。

    在我的情况下,使用tomcat7命令进行部署是有效的:

    tomcat7:deploy
    
    您不应使用:

    tomcat:deploy
    

    我的问题与WAR文件超过50mb这一事实有关。您需要从tomcat管理器在web.xml中设置配置

    该文件通常位于%tomcat installation%\webapps\manager\WEB-INF\WEB.xml中

    <multipart-config>
      <!-- 50MB max -->
      <max-file-size>52428800</max-file-size>
      <max-request-size>52428800</max-request-size>
      <file-size-threshold>0</file-size-threshold>
    </multipart-config>
    
    
    52428800
    52428800
    0
    
    您找到问题的解决方案了吗?我也面临同样的问题。
    <multipart-config>
      <!-- 50MB max -->
      <max-file-size>52428800</max-file-size>
      <max-request-size>52428800</max-request-size>
      <file-size-threshold>0</file-size-threshold>
    </multipart-config>