Java 无法从 Netbeans 8.0.1 服务区域内启动 GlassFish 4.1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26004517/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 01:40:36  来源:igfitidea点击:

Cannot start GlassFish 4.1 from within Netbeans 8.0.1 Service area

javanetbeansglassfish

提问by Dominique Bijnens

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:

在 Windows 7 上,我从该站点https://netbeans.org/downloads/下载了“netbeans-8.0.1-javaee-windows.exe”安装程序。安装程序安装 GlassFish 4.1、Java 1.8.0_20 和 NetBeans 8.01。安装后,每当我尝试从 NetBeans 服务区域内启动 GlassFish 服务器时,都会出现以下错误:

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

无法启动 GlassFish Server 4.1:服务器未运行时 HTTP 或 HTTPS 侦听器端口被占用

So I used

所以我用

netstat -ano | find "1527"

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?

找出哪个进程持有此端口,而且似乎是 Java Derby 数据库本身刚刚由 GlassFish 进程启动。因此,Glassfish 初创公司正在抱怨它自己造成的一些事情。奇怪的。我不知道该怎么办。有人有什么想法吗?

Thanks already.

已经谢谢了。

采纳答案by unwichtich

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).

你的描述有点奇怪,因为1527端口被占用GlassFish服务器也能启动,因为Java Derby数据库是一个独立的java进程。因此,一种选择可能是在真正的 GlassFish 服务器确实正确启动的情况下忽略该消息(NetBeans 在不同的选项卡中显示 GlassFish 服务器和 Derby 服务器的输出)。

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

不过,您可以尝试禁用为 GlassFish 实例启动已注册的 Derby 服务器。

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.

确保 Derby 服务器已关闭,如果您关闭了 NetBeans,它甚至仍然可以运行。如果您不确定通过任务管理器杀死每个 java 进程并重新启动 NetBeans。

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

在“服务”选项卡中右键单击您的 GlassFish 实例,然后选择“属性”

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.

如果真正的问题是端口 8080 或 443(如果您激活了 HTTPS 侦听器)正在使用(这确实会阻止 GlassFish 启动),则您必须找出哪个应用程序正在使用此端口(可能是 Tomcat 或类似的) 并将其关闭。

The error message

错误信息

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

“无法启动 GlassFish Server 4.1:服务器未运行时 HTTP 或 HTTPS 侦听器端口被占用”

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

只是在这个方向上多指一点......

回答by James

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.

我也有同样的问题。我的是由 vmware 安装引起的。它是 Windows 7 上的 vmware westation v8,并且是默认安装。

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.

运行 netstat -aon | 查找 ":80" | 从 cmd 中找到“LISTENING”显示了导致问题的服务的 PID,这与 vmware 有关。转到服务,我手动停止了所有正在运行的 vmware 服务(没有更改它们的启动类型,只是手动停止 - 我希望它们在下次重新启动后再次工作)我可以立即测试我的 web 服务,glassfish 4 启动时应该。

Hope it helps

希望能帮助到你

回答by Florin Marcus

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:

我在同一台机器上运行 Oracle XE 实例时遇到同样的错误。由于我的数据库是 Oracle,我更喜欢更改 Glassfish 的默认端口:

  1. Locate domain.xml inside Glassfish installation folders.
  2. Change the the port on the below line:
  1. 在 Glassfish 安装文件夹中找到 domain.xml。
  2. 更改以下行上的端口:

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

回答by Oma

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 Passwordunder Administrationon 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

我找到了一种更简单的方法来解决这个烦人的问题。首次注册 GlassFish Server 时无需设置用户/密码。然后右键单击 GlassFish,然后查看域管理控制台。在GlassFish管理出现的页面中,你会看到更改管理员密码管理的GlassFish控制台-常见任务。单击以通过更改默认密码来设置您的密码。用户是管理员,但密码由您来更改。保存您的更改。返回 Netbeans,您将立即看到一个弹出屏幕,要求您输入管理员凭据。输入 admin 作为用户和密码。这就对了。如果您的 Netbeans 带有 Glassfish,只需右键单击服务器,然后查看域管理控制台,然后按照上面解释的其余步骤进行操作

回答by Jendoubi Zaid

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

您可以通过更改 glassfish 的端口号轻松解决此问题。

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

转到domain.xml位于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 8080by 9090for example, then save file and run glassfish again. it should nicely work.

取代8080通过9090例如,然后保存文件并再次运行GlassFish的。它应该很好地工作。

回答by Khalidt

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:

我也有这个问题,是因为有一个应用程序正在侦听8080端口。为了解决这个问题,我按照以下步骤操作:

  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.

  1. 打开 cmd.exe 然后输入

    netstat -aon | 查找 ":8080" | 找到“聆听”

  2. 你会看到这样的结果

    TCP 0.0.0.0:8080 0.0.0.0:0 聆听 1464

  3. 复制PID“1464”。

  4. 打开任务管理器 (Ctrl+Alt+del),转到详细信息标签,然后通过 PID 找到正在侦听端口 8080 的程序或服务,然后停止它或结束进程。

回答by Zenford

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

如果您在 oracle xe 上使用 netbeans 7 及更高版本,请在 netbeans 上执行以下操作:

  1. go to services tab
  2. under servers, remove glassfish
  3. add back glassfish server
  4. input port number 9090for http access
  1. 转到服务选项卡
  2. 在服务器下,删除 glassfish
  3. 添加回 glassfish 服务器
  4. 9090http访问的输入端口号

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

如果可用,Glassfish 可以使用该端口号或创建一些随机端口号

回答by Mayur Kapadia

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.

是的你可以通过更改glassfish的端口号来解决这个错误,因为WAMP SERVER或者ORACLE数据库软件使用的是8080端口号,所以存在端口号冲突。

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

1) 打开像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...

2) 使用ctrl+F 找出8080 端口号。您将获得以下代码...

<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..

3) 将该端口号从 8080 更改为 9090 或 1234 或任何您喜欢的..

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

4)保存。打开一个 Netbeans IDE 转到 glassfish 服务器。

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

5) 右键单击​​服务器 -> 选择刷新选项。

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

6)检查端口号。这是由您提供的,只需右键单击服务器-> 属性即可。

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

7) 启动 Glassfish 服务器。Yehhh 错误消失了...

回答by Akshay Chopra

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 Taband 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
  1. 打开 CMD:从键盘按 Windows+R 或在 Windows 搜索中键入“cmd”
  2. 在 cmd 中输入以下内容: netstat -aon | find ":8080" | find "LISTENING"
  3. 请参阅最后一列:会有一些数字,如 2816 或类似的数字。(与此不同)
  4. 现在,打开任务管理器(键盘快捷键:Ctrl+Shift+Esc
  5. 在那里,转到详细信息选项卡,然后在PID Column 下,搜索您在第 3 步中找到的数字
  6. 右键单击它并选择 end process
  7. 现在愉快地转到 Netbeans 并运行您的程序

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.

注意:如果您是第一次在 Netbeans 中运行程序,则需要一些时间。因此,如果需要时间,请不要担心。

回答by Kusal Thiwanka

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

尝试以下步骤

1. 打开命令提示符(按 Windows 键并键入“cmd”并按 Enter)然后键入此命令如图所示

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

netstat -aon | 查找 ":8080" | 找到“聆听”cmd命令

  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
  1. 现在打开任务管理器(按 Windows 键并键入“任务管理器”并按 Enter)在其中,转到详细信息选项卡,在 PID 列下,搜索您在 cmd 中找到的数字

task manager

任务管理器

  1. Right Click on that program and select end process
  1. 右键单击该程序并选择结束进程