How to deploy to Tomcat from NetBeans?
Solution 1
When you create a Maven based web app project, you specify the spec version of the project as you create it.
If you want to create a project that you can deploy with Tomcat, you need to change the value of the 'Java EE Version' field from 'Java EE 6' to 'Java EE 5', before you hit the Finish button.
Note: I had hoped that there was a simple change that could be applied to your projects pom file to convert it from Java EE 6 to Java EE 5... but it turns out that it is not so easy...
Solution 2
Is your webapp a real Java EE 6 webapp (without web.xml
or with a Servlet 3.0 web.xml
)?
If yes, maybe NetBeans doesn't show Tomcat because Tomcat is not a valid runtime environment for your application (use GlassFish).
Solution 3
Go into your web.xml and replace the header with:
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Go back to properties and you will be able to pick Tomcat
Solution 4
If you right-click the project, select Properties and go to Run, there should be a dropdown list of servers. Is that one empty as well?
Solution 5
Add this to your pom.xml
after: <repositories></repositories>
<properties>
<netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
</properties>
deamon
Updated on August 20, 2020Comments
-
deamon over 3 years
I've added Tomcat in the "Tools > Servers" menu and as you can see it appears in the list of servers:
But when I try to run my project, I cannot select Tomcat! The drop-down with servers is empty. I tried it with NetBeans 6.8 and 6.9 Beta. Any idea?
The end: I've used the wrong archetype so that NetBeans decided that Tomcat is not capable to execute it.