2

I'm trying to deploy WAR like in this example https://stackoverflow.com/a/4144674/758661

DeployTask task = new DeployTask();
  task.setUrl("http://localhost:8080/manager/text");
  task.setUsername("tomcat");
  task.setPassword("s3cret");
  task.setPath("/updater");
  task.setWar(warFile.getAbsolutePath());
  task.execute();

But get an 403 error:

Server returned HTTP response code: 403 for URL: 
http://localhost:8080/manager/text/deploy?path=%2Fupdater

I think it is because "/" has been replaced to "%2F" (password and username are like in tomcat-users.xml)

How can I prevent replacing "/" to "%2F"? Or any other ideas? Thx.

Community
  • 1
  • 1
ForeverSmiling
  • 111
  • 3
  • 10

2 Answers2

1

The replacement isn't a problem, it's normal for a parameter to be urlencoded. The server wouldn't be able to receive it if it weren't encoded.

And "403" means "forbidden".

I suppose it's because you have a strange URL. Replace

task.setUrl("http://localhost:8080/manager/text");

by

task.setUrl("http://localhost:8080/manager");
Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
0

I solve it.

In Overview of Tomcat Server in Eclipse (right-click on server -> open) in "Server Locations" I had to choose the secons radio-button "Use Tomcat installation" (by default it set to first "Use workspace metadata".

Because in default case Tomcat starts without the manager app wich needed in this case.

ForeverSmiling
  • 111
  • 3
  • 10