Cannot start GlassFish 4.1 from within Netbeans 8.0.1 Service area
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:
- Locate domain.xml inside Glassfish installation folders.
- 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>
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:
Open cmd.exe then type
netstat -aon | find ":8080" | find "LISTENING"
You will see like this result
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 1464
Copy PID "1464".
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.
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.
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...