简体   繁体   English

无法启动GlassFish 4.0(Windows) - 端口1527 - 已在使用的地址

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

I'm a newbie in Java EE 7. 我是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. 我有一台带有GlassFish 4.0和Java EE 7的Netbeans 7.4。在一台64位Windows 8.1 Pro机器上。 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. 我想启动GlassFish 4.0 Server,所以我点击Netbeans中的服务选项卡,然后在Servers选项中右键单击GlassFish Server 4.0,然后单击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". 当我这样做时,我得到以下消息:“无法启动GlassFish Server 4.0:服务器未运行时HTTP或HTTPS侦听器端口被占用”。 I have also the IIS server, but I stopped it. 我也有IIS服务器,但我停止了它。 After stopping IIS I tried to start again the GlassFish but it showed me the same message. 停止IIS后,我试图再次启动GlassFish,但它向我显示了相同的消息。

Also there is a window in Netbeans called Output - Java DB Database Process and it showed me the following: Netbeans中还有一个名为Output - Java DB Database Process的窗口,它向我展示了以下内容:

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. 我在Windows中运行了一个netstat -a来查看1527端口发生了什么,并且该端口处于LISTENING模式。

So how can I know what application or process is ocuppying the 1527 port? 那么我怎么知道1527端口的应用程序或进程是什么?

Thanks for your help !! 谢谢你的帮助 !!

To find the process 1 that keeps the busy port, try the following command: 要查找保留繁忙端口的进程1 ,请尝试以下命令:

netstat -ano | find "1527"

This will show a line with the port and the identifier of the process. 这将显示一个包含端口和进程标识符的行。 eg: 例如:

TCP    127.0.0.1:1527         0.0.0.0:0              LISTENING       2268

Once you have the process ID (eg 2268 ), run the following command for release the port (this will kill the process): 获得进程ID(例如2268 )后,运行以下命令以释放端口(这将终止进程):

taskkill /F /PID 2268

Now, try to start Glassfish. 现在,尝试启动Glassfish。


On Linux: 在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? 1如果您想了解相关程序,请参阅如何找出使用某个端口的服务?

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 转到C:\\ Program Files \\ glassfish-4.1 \\ glassfish \\ domains \\ domain1 \\ config

  2. Open "domain.xml" in a xml editor or u can use notepad++ 在xml编辑器中打开“domain.xml”,或者您可以使用notepad ++

  3. Find "8080"(below highlighted for ur reference) 找到“8080”(以下突出显示供您参考)

    network-listener port=" 8080 " protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool" 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. 用任何开放端口替换“8080”。 If you don't know how to find out open port try to use port no "3702" then save your file 如果你不知道如何找到开放端口尝试使用端口号“3702”然后保存您的文件

  5. now run your project 现在运行你的项目

After running the project please have an eye on the URL 运行项目后,请关注URL

http://localhost:8080/ ...... should be http://localhost:3702/ ..... http:// localhost:8080 / ......应该是http:// localhost:3702 / .....

To get open ports follow the below steps 要获得开放端口,请按照以下步骤操作

  1. open cmd.exe 打开cmd.exe

  2. execute cmd "netstat -ano" 执行cmd“netstat -ano”

Pick any one which you find is free(Like inside the green box above ) 选择你发现的任何一个是免费的(就像在上面的绿色框内) 在此输入图像描述

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. 当您启动GlassFish时,NetBeans还将启动JavaDB(aka,Derby)数据库,该数据库默认侦听端口1527。 When you shut down NetBeans, it will shut down GlassFish but will not shut down JavaDB. 当您关闭NetBeans时,它将关闭GlassFish但不会关闭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. 因此,当您第二次启动NetBeans时,NetBeans将尝试再次启动JavaDB并因为它已在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). 要关闭数据库,可以使用NetBeans服务(选项卡) - >数据库 - > JavaDB(右键单击 - >停止服务器。要从命令行关闭,请使用$ NETBEANS_HOME / glassfish-4.0 / javadb / bin / stopNetworkServer,其中$ NETBEANS_HOME是安装NetBeans的顶级目录(至少在Mac / Linux / Unix上)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM