3

Let me start out by saying that I am new to Java/JSP web development, so I may have totally missed something simple. If so, I apologize for it in advance.

Basically, what I am trying to do is setup local development sites in Tomcat as a separate Virtual Host, similiar to how I have setup Apache Virtual Hosts in the past. I hate accessing a local dev site using http://localhost:8080/mywebapp. In Tomcat, I have added a new Host element in the server.xml and modified my Windows hosts file so that now I can access my site with the url http://mywebapp:8080, which is exactly what I want. Everything works flawless to this point.

The problem starts when I try to use a NetBeans 6.8 JSP project to work on the site. NetBeans is dead set on using http://localhost:8080/mywebapp no matter what I do when I debug or run the site through it. I cannot find anywhere to change what url the site should use in any of the Properties menus. Does anyone know how to change this or anything I may have missed along the way? When I set up PHP projects in NetBeans it allows me to enter the url I want to run the site from and to change it through the project properties.

Again, JSP development and Tomcat are very new to me, but I am very anxious to get started making JSP sites after working with ASP.NET for the past few years. Thanks!

Jason Watkins
  • 1,705
  • 5
  • 18
  • 30

1 Answers1

3

I finally figured it out, well, I figured it out enough to work for me. To make Netbeans see the servers as I want, you have to create a new server in the Add Server dialog and give it a different path than the default Catalina base. Then, when setting up the project, set the context path to nothing and now the site will be run as http://localhost:8080 and not http://localhost:8080/xxxxx. While this isn't exactly what I wanted, it does work for me for now.

Jason Watkins
  • 1,705
  • 5
  • 18
  • 30
  • Thank you for taking your time to answer your question. I have tried your method and I found that you do not need to create a new server or set different Catalina base path. All you have to do, is as you mentioned, set the context path to nothing in the project settings *and* redeploy the project - that is simply click the run button. Only after redeployment the project will work on new context path - in this case, it will be /. – kazy Dec 18 '14 at 14:15