Chechulin
Chechulin

Reputation: 2496

Cannot deploy java Web Application to Tomcat in Netbeans

I am going to write several simple web apps, but I have an issue with deploying applications. I use NetBeans IDE 8.0 (Build 201403101706) with Apache Tomcat 8.0.3 (that came along with Netbeans).
After I click 'deploy' on my web app, there is a new WebApplication1 run-deploy window. It contains:

ant -f C:\\Users\\chechulin\\Documents\\NetBeansProjects\\WebApplication1 -Dbrowser.context=C:\\Users\\chechulin\\Documents\\NetBeansProjects\\WebApplication1 -DforceRedeploy=true -Ddirectory.deployment.supported=true -Dnb.wait.for.caches=true -Dnb.internal.action.name=redeploy run-deploy
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:

And there is a never-ending 'Deploying WebApplication1" process. Server shows that there is no apps. And I cannot expand Web Applications node that should be like on the following picture: web apps tomcat

But when I take .war file from the project /dist directory and manually deploy in to the server, it works fine!
I just cannot figure where is the problem!

Upvotes: 1

Views: 8650

Answers (3)

marcor92
marcor92

Reputation: 537

I got the same error: Netbeans then hangs when deploying on Apache Tomcat. I found out that the version of Java of my application was not supported by the version of Tomcat I was trying to deploy into. In particular, I was trying to deploy a Java 8 (also known as Java 1.8) JSP application into Tomcat 11.

Then I checked the Apache Tomcat compatibility list: https://tomcat.apache.org/whichversion.html and found out that Java 8 was supported until Apache Tomcat 9.0.x. I downloaded then Tomcat 9, configured in the Netbeans Servers (via the menu Tools->Servers), and the application was deployed successfully.

Also, I had to kill a previously running Tomcat server on the same port (8080) that blocked my new server from launching. I couldn't find that process from the Tasklist in Windows, but I could successfully find and kill it via the command line commands:

netstat -aon |find /i "listening" |find "8080"

and then copy the PID into the kill command:

taskkill /F /PID

Ex: taskkill /F /PID 189

See also this answer (where I took these commands from): https://stackoverflow.com/a/42084313/5538923 .

Upvotes: 0

maddy23285
maddy23285

Reputation: 786

Open tomcat_users.xml as administrator, you can find it under conf folder like in my case C:\Program Files\Apache Software Foundation\Tomcat 8.0\conf\tomcat_users.xml and find tag <user> and add role manager-script in roles attribute like this

<user username="admin" password="admin" roles="admin-gui,manager-gui,manager-script" />

But make sure tomcat is not running.

Upvotes: 3

Ali Akkaya
Ali Akkaya

Reputation: 61

I faced the same error. It seems that Netbeans can not deploy to Tomcat7 and Tomcat8 (Or at least i could not find the way how to do it). Netbeans log files gives below error

INFO [org.netbeans.modules.tomcat5.deploy.TomcatManagerImpl]: TomcatManagerImpl connecting to: http://localhost:8080/manager/list java.io.FileNotFoundException: http://localhost:8080/manager/list

Similarly it tries to use manager/deploy for deploying.

Tomcat documentation states that after tomcat7 they changed the structure and these two links are not available anymore.

When I installed Tomcat6 and configured at Netbeans, it worked and deployed as expected.

Upvotes: 2

Related Questions