Could not start GlassFish 4.0 (Windows) - port 1527 - Address already in use

懵懂的女人 提交于 2019-12-03 12:38:10

问题


I'm a newbie in Java EE 7.

I have Netbeans 7.4 with GlassFish 4.0 and Java EE 7. In a 64-bit Windows 8.1 Pro machine. I want to start the GlassFish 4.0 Server, so I clicked on the services tab in Netbeans and then in the Servers option I right-clicked GlassFish Server 4.0 and then clicked Start.

When I did that I got the following message: "Could not start GlassFish Server 4.0: HTTP or HTTPS listener port is occupied while server is not running". I have also the IIS server, but I stopped it. After stopping IIS I tried to start again the GlassFish but it showed me the same message.

Also there is a window in Netbeans called Output - Java DB Database Process and it showed me the following:

Tue May 06 22:03:11 GMT-05:00 2014 : Security manager installed using the Basic server security policy.
Tue May 06 22:03:11 GMT-05:00 2014 Thread[main,5,main] java.io.FileNotFoundException: D:\Users\Juan Jose\.netbeans-derby\derby.log (Access is denied)
Tue May 06 22:03:12 GMT-05:00 2014 : Could not listen on port 1527 on host localhost:
 java.net.BindException: Address already in use: JVM_Bind
Tue May 06 22:03:12 GMT-05:00 2014 : Could not listen on port 1527 on host localhost:
 java.net.BindException: Address already in use: JVM_Bind

I ran a netstat -a in Windows to see what was happening with the 1527 port and that port is in LISTENING mode.

So how can I know what application or process is ocuppying the 1527 port?

Thanks for your help !!


回答1:


To find the process1 that keeps the busy port, try the following command:

netstat -ano | find "1527"

This will show a line with the port and the identifier of the process. e.g.:

TCP    127.0.0.1:1527         0.0.0.0:0              LISTENING       2268

Once you have the process ID (e.g. 2268), run the following command for release the port (this will kill the process):

taskkill /F /PID 2268

Now, try to start Glassfish.


On Linux:

lsof -Pnl +M -i6 | grep 1527

Produces:

java    31139     1001   32u  IPv6 114916062      0t0  TCP 127.0.0.1:1527 (LISTEN)

Killed with:

kill -9 31139

1 If you want to know the associated program, see How do I find out what service is using a certain port?




回答2:


If the above doesn't work for anyone pls follow the below steps.. Sure It will work..

  1. Go to C:\Program Files\glassfish-4.1\glassfish\domains\domain1\config

  2. Open "domain.xml" in a xml editor or u can use notepad++

  3. Find "8080"(below highlighted for ur reference)

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

  4. Replace "8080" with any open port. If you don't know how to find out open port try to use port no "3702" then save your file

  5. now run your project

After running the project please have an eye on the URL

http://localhost:8080/...... should be http://localhost:3702/.....

To get open ports follow the below steps

  1. open cmd.exe

  2. execute cmd "netstat -ano"

Pick any one which you find is free(Like inside the green box above )




回答3:


This is not an error you need to worry about. When you start GlassFish, NetBeans will also start the JavaDB (aka, Derby) database, which listens on port 1527 by default. When you shut down NetBeans, it will shut down GlassFish but will not shut down JavaDB. Therefore, when you start NetBeans a second time, NetBeans will try to start JavaDB again and fail because it is already running and listening on port 1527.

To shut down the database, you can use the NetBeans Services(Tab)->Databases->JavaDB(right click->Stop Server. To shut down from the command line use $NETBEANS_HOME/glassfish-4.0/javadb/bin/stopNetworkServer, where $NETBEANS_HOME is the top-level directory where NetBeans is installed (at least on Mac/Linux/Unix).



来源:https://stackoverflow.com/questions/23521740/could-not-start-glassfish-4-0-windows-port-1527-address-already-in-use

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!