java Netbeans 和 Glassfish 部署问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5937978/
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-10-30 13:33:31  来源:igfitidea点击:

Netbeans and Glassfish Deployment Issue

javanetbeansglassfishportglassfish-3

提问by Mathew

I have written a web application using netbeans which I have always deployed to the Glassfish server through netbeans itself. Now that I've finished it, I want to be able to run it independently of netbeans, and this was succesful on the first PC I tried it on, I started the glassfish server using "start-domain" command, and my previously deployed service was already there waiting for me.

我已经使用 netbeans 编写了一个 Web 应用程序,我一直通过 netbeans 本身将其部署到 Glassfish 服务器。现在我已经完成了它,我希望能够独立于 netbeans 运行它,这在我尝试的第一台 PC 上成功,我使用“start-domain”命令启动了 glassfish 服务器,并且我之前部署过服务已经在那里等我了。

However I have since tried doing this on another PC. The service deploys completely fine through netbeans, but when I try starting the glassfish server on its own, the problems start. For some strange reason netbeans seems to be using a different version of glassfish to me, because if I start the server, and then go to netbeans to deploy the service, I get the following error message:

但是,我已经尝试在另一台 PC 上执行此操作。该服务通过 netbeans 部署得非常好,但是当我尝试自己启动 glassfish 服务器时,问题就开始了。出于某种奇怪的原因,netbeans 对我来说似乎使用了不同版本的 glassfish,因为如果我启动服务器,然后转到 netbeans 部署服务,我会收到以下错误消息:

Starting GlassFish Server 3.1
GlassFish Server 3.1 Server cannot start. Port is occupied.
In-place deployment [path]
Initializing...
deploy?DEFAULT=[path] failed. Instance is not GlassFish Server 3.1.

I only have one version of glassfish installed, and that is 3.1. In the project settings I have the correct Glassfish server selected, but still, it seems to be running it separately. Any help would be very much appreciated, because it's confused the heck out of me!

我只安装了一个版本的 glassfish,那就是 3.1。在项目设置中,我选择了正确的 Glassfish 服务器,但它似乎仍然单独运行。任何帮助将不胜感激,因为它让我感到困惑!

回答by Jigar Joshi

GlassFish Server 3.1 Server cannot start. Port is occupied.

GlassFish Server 3.1 服务器无法启动。端口被占用。

Your GF (server I meant;) )is trying to open a port which is aquired by some other process.

您的 GF(我的意思是服务器;))正在尝试打开一个由其他进程获取的端口。

You can look for the process that is binded with port using netstat -aon

您可以使用以下命令查找与端口绑定的进程 netstat -aon

Check heremy answer for detailed information

在这里查看我的答案以获取详细信息

回答by alicanbatur

finally i solved the problem for glassfish.

最后我解决了 glassfish 的问题。

here you are :

这个给你 :

  1 - find where glassfish is installed. if you dont know check here; 
  Select Services window by using **Window -> Services** in NetBeans IDE
  Expand **Server**s node and select GlassFish Domain
  Right click and select **Properties** 
  On the right of Domains Folder you can see the folder where **GlassFish** is installed.

  2 - go to directory. eg: mine is  **C:\Users\UserME\.netbeans.1\config\GF3\domain1\config**
  3 - here you will find a **domain.xml**
  4 - open domain.xml and find **8080**. change 8080 t0 **8284** and **save domain.xml**
  5 - enjoy your software :P 

PS: We changed port to 8284 but be carefulthat 8284 is not in use. if it is in use too you can change any other number.

PS:我们把端口改成了8284,但是要注意8284没有被使用。如果它也在使用中,您可以更改任何其他号码。

regards.

问候。

回答by fvu

I don't think you have registered the instance of Glassfish that you started manually with Glassfish (Services tab, rightclick on Servers, Add Server, type Glassfish 3.1, point to the base directory of the installation. Now Netbeans should recognize that server, and show that it's running.

我认为您没有注册使用 Glassfish 手动启动的 Glassfish 实例(服务选项卡,右键单击服务器,添加服务器,键入 Glassfish 3.1,指向安装的基本目录。现在 Netbeans 应该识别该服务器,并且显示它正在运行。

On the other hand, why don't you just deploy the built war or ear to Glassfish via its console? You don't haveto pass through Netbeans for deployment....

另一方面,为什么不通过其控制台将内置的War或耳朵部署到 Glassfish?你不具备通过NetBeans中通过部署....