0
votes

I have Tomcat 8.0.15.0, Glassfish 4.1 and NetBeans 8.0.2 installed on my PC, which I installed simultaneously from Netbeans.org.

All three don't seem to be working together well on my PC as the following problem scenario illustrates:

With Netbeans inactive, I ran startup.bat from the Tomcat Program/bin folder and Tomcat page appeared on Web at http://localhost:8080 as expected.

I then created a project FirstServlet in NetBeans using the Tomcat library where I coded a servlet. When I run the project I get the following error message:

C:\Users\Jon\Documents\NetBeansProjects\FirstServletApp\nbproject\build-impl.xml:1045: Deployment error: Starting of Tomcat failed.

I created a second project with a different name and identical functionality using the Glassfish library. but when I tried to run, I got the error message:

Could not start GlassFish Server 4.1: HTTP or HTTPS listener port is occupied while server is not running.

I then ran shutdown.bat from Tomcat Program/bin folder and returned to NetBeans and was able to run the second project successfully and on the Web the Glasssish page appears on http://localhost:8080.

How I can set things up so I can create projects using either Tomcat or Glassfish library in NetBeans and can successfully run both?

1

1 Answers

0
votes

You can easily change the ports for Tomcat. It is opening 3 ports : 8005, 8080 and 8009. Open the conf/server.xml file and change those values. After the next start, the conflicts shouldn't appear anymore.

You may have a look at the complete documentation of Tomcat connectors (http, ajp).

If you prefer to change the port on the Glassfish size, you'll have to open the glassfish/domains/domain1/config/domain.xml file, and change the port attribute of the network-listener(s).