17

On Windows 7 I downloaded the 'netbeans-8.0.1-javaee-windows.exe' installer from this site https://netbeans.org/downloads/. The installer installs GlassFish 4.1, Java 1.8.0_20 and NetBeans 8.01. After installation, whenever I try to start the GlassFish server from within the NetBeans Services area, I get this error:

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

So I used

netstat -ano | find "1527"

to find out which process is holding this port and as it seems it is the Java Derby database itself that was just started by the GlassFish process. So the Glassfish startup is complaining about something it just caused itself. Strange. I don't know what to do. Anybody any idea?

Thanks already.

ziMtyth
  • 1,008
  • 16
  • 32
Dominique Bijnens
  • 353
  • 1
  • 2
  • 9

10 Answers10

20

I also had this problem, it is because there is an application LISTENING to 8080 port. To solve this problem I followed the below steps:

  1. Open cmd.exe then type

    netstat -aon | find ":8080" | find "LISTENING"

  2. You will see like this result

    TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 1464

  3. Copy PID "1464".

  4. Open Task Manager (Ctrl+Alt+del), go to the details tag, then find the program or service via PID that is listening to the port 8080 then STOP it or End process.

Khalid
  • 199
  • 2
  • 3
14

Your description is a little bit strange because the GlassFish server can even start if port 1527 is occupied, because the Java Derby database is a separate java process. So one option could be to just ignore the message in case that the real GlassFish server is indeed starting correctly (NetBeans displays the output for the GlassFish server and the Derby server in different tabs).

Nevertheless you can try to disable starting the registered Derby server for your GlassFish instance.

Make sure that the Derby server is shut down, it can even still run if you have closed NetBeans. If you are not sure kill every java process via the task manager and restart NetBeans.

Right-click your GlassFish instance in the Services tab and choose Properties.

disable derby server start

If instead the real problem is that either port 8080 or 443 (if you activated the HTTPS listener) is in use (which would really prevent GlassFish from starting), you have to find out which application is using this port (maybe Tomcat or something similar) and shut it down.

The error message

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

just points a little bit more in this direction...

unwichtich
  • 13,712
  • 4
  • 53
  • 66
  • 1
    Dear unwichtich you're right: it has nothing to do with the Derby server. Unchecking the box inisde the Glassfish properties was not the solution. Checking port 8080 was. Since I'm a LabView user I have National Instruments stuff running on my PC. One of the things is National's ApplicationServer that locks port 8080.... So your hint did it. Wonder why I was focused on port 1527, maybe beacuse I'm a complete Glassfish newbie. – Dominique Bijnens Sep 24 '14 at 13:15
  • 1
    Thanks, after read your answer, I Know my port 8080 is used for Tomcat server. Many Thanks – Yohanim Aug 06 '15 at 08:00
  • 1
    @DominiqueBijnens Thank you. I had the same problem. To find this service, I used [http://stackoverflow.com/a/25096959/2278538] comment to find the service so that I could stop it. – KSK Sep 14 '15 at 13:49
11

I get the same error when I run Oracle XE instance on the same machine. As my database is Oracle, I preferred changing Glassfish's default port:

  1. Locate domain.xml inside Glassfish installation folders.
  2. Change the the port on the below line:

  <network-listener port="9090" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
        
Florin Marcus
  • 1,657
  • 1
  • 12
  • 11
8

you can easily resolve this problem by changing the port number of glassfish.

Go to glassfich configuration File domain.xml which is located under GlassFish_Server\glassfish\domains\domain1\config.

Open this file, then change the following line:

<network-listener port="8080" protocol="http-listener-1" transport="tcp" 
name="http-listener-1" thread-pool="http-thread-pool"></network-listener>  

replace 8080 by 9090 for example, then save file and run glassfish again. it should nicely work.

Nir Levy
  • 12,750
  • 3
  • 21
  • 38
Jendoubi Zaid
  • 119
  • 1
  • 4
6

You will get like this error

error ss

Try the following steps

1. Open Command Prompt (Press Windows key and type "cmd" and hit Enter) Then type this command as show in picture

netstat -aon | find ":8080" | find "LISTENING" cmd command

  1. Now open Task Manager (Press Windows key and type "Task Manager" and hit Enter) In that, go to Details Tab and under PID Column, search for the number you found in cmd

task manager

  1. Right Click on that program and select end process
Kusal Thiwanka
  • 151
  • 1
  • 4
5

I have the same problem. Mine is caused by a vmware installation. It is vmware worstation v8 on windows 7 and was a default installation.

Running netstat -aon | find ":80" | find "LISTENING" from cmd showed PID of the service causing the problem, this related to vmware. Going to services, I manually stopped all of the running vmware services (did not change their start up type, just a manual stop - I want them to work again after the next reboot) I could immediately test my webservice, glassfish 4 started as it should.

Hope it helps

James
  • 51
  • 1
  • Thanks a lot! In my case the problem was with Skype. The command you typed solved my issue. – malarres May 29 '15 at 15:22
  • When PID is found (with the above method) you could also start "Task manager" (ctrl+alt+delete) go to the tab "Services" and click on the column name "PID" (this reorders the rows in the table by PID) find the process that has the PID showed by netstat. Click with right mouse button on that row and choose "Stop service". – Developer Marius Žilėnas Jun 23 '15 at 08:45
  • @James I tried what you suggested: "netstat ..." and it returned: "TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 4988" Any idea what this means? – KSK Sep 14 '15 at 13:29
3

Yes you can solve this error by changing the port number of glassfish because the WAMP SERVER or ORACLE database software uses a port number 8080, so there is a conflict of port number.

1)open a path like C:\GlassFish_Server\glassfish\domains\domain1\config\domain.xml.

2)find out the 8080 port number with the help of ctrl+F. You will get the following code...

<network-listener protocol="http-listener-1" port="8080" name="http-listener-1" thread-pool="http-thread-pool" transport="tcp">

3) Change that port number from 8080 to 9090 or 1234 or whatever you like..

4) Save it. Open a Netbeans IDE goto the glassfish server .

5) Right click on the server -> select refresh option.

6) to check the port no. which is given by u just right click on the server-> property.

7) Start the Glassfish server . Yehhh the error is gone...

2

If you are using netbeans 7 and greater with oracle xe do the following on netbeans :

  1. go to services tab
  2. under servers, remove glassfish
  3. add back glassfish server
  4. input port number 9090 for http access

Glassfish can use that one if available or some random port number is created

Dhaval Patel
  • 10,119
  • 5
  • 43
  • 46
Zenford
  • 21
  • 3
1

Following are the steps that will definitely work:

  1. Open CMD : Press Windows+R from keyboard or just type "cmd" in windows search
  2. Type Following in cmd : netstat -aon | find ":8080" | find "LISTENING"
  3. See the last column : There will be some number like 2816 or similar.(It will differ from this)
  4. Now open Task Manager (Keyboard shortcut : Ctrl+Shift+Esc)
  5. In that, go to Details Tab and under PID Column, search for the number you found in step 3
  6. Right Click on it and select end process
  7. Now happily go to Netbeans and Run your program

NOTE : If you are running your program for the first time in Netbeans, it takes some time. So don't worry if it takes time.

Akshay Chopra
  • 1,035
  • 14
  • 10
0

I found an easier way to go about this nagging problem. Register GlassFish Server without setting user/password the first time. Then right click GlassFish then to View Domain Admin Console. On the Glassfish admin page that appears, you will see Change Administrator Password under Administration on the GlassFish Console- Common Tasks. Click to set your password by changing the default password. The user is admin but the password is up to you to change it. Save your change. Go back to Netbeans and you will immediately see a popout screen asking you to enter your admin credentials. Enter admin for user and the password. That is it. If your Netbeans come with Glassfish, just right click the server then to View Domain Admin Console then follow the rest of the steps explained above

Oma
  • 1