Bug 62809

Summary: cannot remote deploy with Ant DeployTask
Product: Tomcat 9 Reporter: Satoshi Kubo <megascus>
Component: ManagerAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 9.0.12   
Target Milestone: -----   
Hardware: PC   
OS: All   

Description Satoshi Kubo 2018-10-09 07:33:49 UTC
I try to remote deploy with Ant DeployTask, but it not works.


source
----
DeployTask deployer = new DeployTask();
deployer.setUpdate(true);
deployer.setWar("C:\\tmp\\WebApplication1.war"); // if change to setLocalWar, it works.
deployer.setUsername("tomcat");
deployer.setPassword("tomcat");
deployer.setUrl("http://localhost:8080/manager/text");
deployer.setPath("/WebApplication1");

deployer.execute();





stacktrace
----
Exception in thread "main" java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
	at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:270)
	at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:178)
	at tomcattest.TomcatTest.main(TomcatTest.java:28)
Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1692)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:231)
	... 2 more
Comment 1 Mark Thomas 2018-10-15 18:54:54 UTC
This appears to be a consequence of the way DIGEST support was implemented for bug 45832. I'm currently looking at options for fixing this.
Comment 2 Mark Thomas 2018-10-15 19:34:20 UTC
As a work-around, use the following code before the DeployTask. It causes the credentials to be cached so the DeployTask is performed with the credentials present which avoids this issue.
Comment 3 Mark Thomas 2018-10-15 19:50:19 UTC
Sorry, missed the code:

ListTask list = new ListTask();
list.setUsername("tomcat");
list.setPassword("tomcat");
list.setUrl("http://localhost:8080/manager/text");
list.execute();
Comment 4 Satoshi Kubo 2018-10-16 08:06:52 UTC
Thanks.
Your information helped me a lot.
Comment 5 Mark Thomas 2018-10-16 10:25:14 UTC
Fixed in:
- trunk for 9.0.13 onwards
- 8.5.x for 8.5.35 onwards
- 7.0.x for 7.0.92 onwards