GlassFish 3.1 无法从 Eclipse 启动

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

GlassFish 3.1 won't start from Eclipse

eclipseglassfish-3

提问by Coder Doe

I'm using Linux, and I've installed GlassFish 3.1 outside of Eclipse. It starts fine with asadmin start-domain.

我使用的是 Linux,并且已经在 Eclipse 之外安装了 GlassFish 3.1。它从 asadmin start-domain 开始很好。

In Eclipse Helios I've installed the latest version of the GlassFish tools, server adapter etc. I've added a "Server" instance for my external GlassFish, but when I try to start it, the Eclipse Console says "Waiting for domain1 to start ......" – more and more dots are printed while I wait for several minutes. Eventually there's a dialog saying "Server GlassFish 3.1 at localhost failed to start."

在 Eclipse Helios 中,我安装了最新版本的 GlassFish 工具、服务器适配器等。我为外部 GlassFish 添加了一个“服务器”实例,但是当我尝试启动它时,Eclipse 控制台显示“正在等待域 1 到开始......”——在我等待几分钟的同时,越来越多的点被打印出来。最终会出现一个对话框,提示“本地主机上的 Server GlassFish 3.1 启动失败”。

At no point is http://localhost:8080responding.

http://localhost:8080没有任何响应。

There is no other errors messages that I can find. The server log (glassfish/domains/domain1/server.log) prints the long startup command, and then:

我找不到其他错误消息。服务器日志(glassfish/domains/domain1/server.log)打印长启动命令,然后:

Feb 28, 2011 10:48:45 PM com.sun.enterprise.admin.launcher.GFLauncherLogger info                                                                                                                                  
INFO: Successfully launched in 3 msec.

The GlassFish installation is entirely stock, with no applications loaded. It works fine when started from the command line outside of Eclipse.

GlassFish 安装完全是库存的,没有加载任何应用程序。当从 Eclipse 之外的命令行启动时,它工作正常。

I've tried to reinstall GlassFish to different locations, I've reinstalled Eclipse with no plugins except the GlassFish stuff.

我尝试将 GlassFish 重新安装到不同的位置,我重新安装了 Eclipse,除了 GlassFish 之外没有任何插件。

The strange thing is that the "Internal GlassFish 3.1" server, which is distributed with the Eclipse plugin and lives inside eclipse/plugins, works just fine and starts up very snappily. But I'd really like to have an external GlassFish that I can easily run independently of Eclipse when I want to.

奇怪的是,“内部 GlassFish 3.1”服务器,它与 Eclipse 插件一起分发并位于 eclipse/plugins 中,工作得很好并且启动非常快。但我真的很想拥有一个外部 GlassFish,我可以在需要时轻松地独立于 Eclipse 运行它。

Help much appreciated!

非常感谢帮助!

采纳答案by Ludo

Hum. Good news is that the internal server is working. For the external one, first thing to test is if the server can be started outside Eclipse. Check also the domain directory known by Eclipse (hint: server properties tab), and if the location is the one you want to use. Maybe the domain has been started with a different Glassfish Server? In this case, make sure the osgi-cache/ directory in this domain is deleted first.

哼。好消息是内部服务器正在工作。对于外部的,首先要测试的是服务器是否可以在 Eclipse 之外启动。还要检查 Eclipse 已知的域目录(提示:服务器属性选项卡),以及该位置是否是您要使用的位置。也许域已使用不同的 Glassfish 服务器启动?在这种情况下,请确保先删除此域中的 osgi-cache/ 目录。

回答by guybedo

You can have detailed logs about what is going on :

您可以获得有关正在发生的事情的详细日志:

go to "Window -> Preferences -> Glassfish Preferences".

转到“窗口 -> 首选项 -> Glassfish 首选项”。

There you can check the "Start Glassfish Enterprise Server in Verbose Mode".

在那里您可以检查“以详细模式启动 Glassfish Enterprise Server”。

I had problems starting Glassfish 3.1 from inside eclipse too. I tried to delete the "osgi-cache/" subdirectory located in the domain directory and then i could successfully launch glassfish.

我也从 eclipse 内部启动 Glassfish 3.1 时遇到问题。我试图删除位于域目录中的“osgi-cache/”子目录,然后我可以成功启动 glassfish。

Hope it helps.

希望能帮助到你。

回答by HAmark

CLI130 Glassfish Error and Port 4848 in Use Error

CLI130 Glassfish 错误和端口 4848 使用错误

Glassfish is written in Java and if the system's TCP/IP configuration isn't setup a certain way, Glassfish will choke when it makes a getLocaHost()call. A quick fix is:

Glassfish 是用 Java 编写的,如果系统的 TCP/IP 配置没有以某种方式设置,Glassfish 会在getLocaHost()调用时阻塞。一个快速的解决方法是:

  1. Get the system's hostname and related IP
    • hostname
    • ifconfig -a
  2. Add a line to /etc/hosts after the localhost line:

    hostname ip-address-of-hostname

  1. 获取系统的主机名和相关IP
    • 主机名
    • ifconfig -a
  2. 在 localhost 行之后的 /etc/hosts 添加一行:

    主机名 ip-address-of-hostname

A Little More Background.....

多一点背景.....

If the local hostname (value returned from the "hostname" command) does not resolve to an IP address (e.g. "nslookup my-hostname") Glassfish will fail. The following Java app will expose this:

如果本地主机名(从“hostname”命令返回的值)不能解析为 IP 地址(例如“nslookup my-hostname”),Glassfish 将失败。以下 Java 应用程序将公开此内容:

import java.net.*;
class Testnet {
    public static void main() throws Exception {
        InetAddress host = InetAddress.getLocalHost();
        System.out.println ("host=" + host.getHostName());
        System.out.println ("addr=" + host.getHostAddress());
    }
}

The root cause could be any one of a number of issues:

根本原因可能是许多问题中的任何一个:

  • The Local hostname (value returned from "hostname" command) does not resolve to an IP or valid IP
  • Misconfigured /etc/nsswitch.conf or /etc/hosts
  • There have been suggestions on the web that IPV6 only addressing messes up Java in Linux. To make sure this won't befall you, it can be set on most flavors of Linux with the following command (however the above Testnet app ran for us with bindv6only set to both 1 and 0):

    sysctl -w net.ipv6.bindv6only=0

  • 本地主机名(从“主机名”命令返回的值)未解析为 IP 或有效 IP
  • 错误配置的 /etc/nsswitch.conf 或 /etc/hosts
  • 网上有人建议 IPV6 只解决 Linux 中的 Java。为确保您不会遇到这种情况,可以使用以下命令在大多数 Linux 版本上设置它(但是,上面的 Testnet 应用程序为我们运行,同时将 bindv6only 设置为 1 和 0):

    sysctl -w net.ipv6.bindv6only=0

In terms of HA, having an entry for the local IP and hostname in /etc/hosts is a solid thing to do and to make sure "files" is the first entry in the list for "hosts" in /etc/nsswitch.conf. The downside to this is that each host needs to be setup with this line and it could cause problems with nodes that get their IP from DHCP or are randomly assigned when configured.

在 HA 方面,在 /etc/hosts 中有一个本地 IP 和主机名的条目是一件可靠的事情,并确保“文件”是 /etc/nsswitch.conf 中“主机”列表中的第一个条目. 这样做的缺点是每个主机都需要使用这条线路进行设置,这可能会导致从 DHCP 获取 IP 或在配置时随机分配的节点出现问题。

回答by Ryan M

I've met the same problem as I was learning java web programming, but in netbeans - windows env. I've spent much time guessing what that error could mean because the log file wasn't clearly saying that.

我在学习 java web 编程时遇到了同样的问题,但是在 netbeans - windows env 中。我花了很多时间猜测该错误可能意味着什么,因为日志文件没有明确说明这一点。

Finally I found out that glassfish v3 was trying to run on 8080 port, which was already occupied by reportingservicesservice.exe which is sql server service.

最后我发现glassfish v3试图在8080端口上运行,该端口已经被sql server服务的reportingservicesservice.exe占用。

go to (tools -> servers) add a new glassfish server instance which runs on a different, free port - that solved the problem.

转到(工具 - > 服务器)添加一个新的 glassfish 服务器实例,该实例在不同的自由端口上运行 - 解决了问题。

回答by Ahmed

The suggestion to delete "osgi-cache" worked for me on ONE machine (at work).

删除“osgi-cache”的建议在一台机器上(在工作中)对我有用。

However on my home machine, neither that suggestion nor the suggestion to add my machine's hostname to the "hosts" file helped. Glassfish would start but Eclipse wouldn't recognize that...

然而,在我的家用机器上,无论是该建议还是将我的机器的主机名添加到“hosts”文件的建议都没有帮助。Glassfish 会启动,但 Eclipse 不会识别...

The only thing that worked for me was:

唯一对我有用的是:

  1. go to the glassfish3/bin directory
  2. execute "asadmin create-domain newdomain"
    • in this step, I was prompted for an admin username and password; I chose "admin" and "admin123" respectively
  3. create a Glassfish server in Eclipse pointing to the new domain
  1. 转到 glassfish3/bin 目录
  2. 执行“asadmin create-domain newdomain”
    • 在这一步中,我被提示输入管理员用户名和密码;我分别选择了“admin”和“admin123”
  3. 在 Eclipse 中创建一个指向新域的 Glassfish 服务器

Now I know that this may mean that the default domain (domain1) has some strange configuration, but that just doesn't seem right. Anyway, this did work for me, and now I can start Glassfish from within Eclipse - any Glassfish domain that I want.

现在我知道这可能意味着默认域 (domain1) 有一些奇怪的配置,但这似乎不正确。无论如何,这确实对我有用,现在我可以从 Eclipse 中启动 Glassfish - 我想要的任何 Glassfish 域。

HTH.

哈。

回答by Ravshan Samandarov

I'm using ubuntu 13.04 and had the same issue. I tried almost everything, but when i disabled IPv6 it worked. For ubuntu it's easy, just add following 3 lines to kernel parameters:

我正在使用 ubuntu 13.04 并且遇到了同样的问题。我几乎尝试了所有方法,但是当我禁用 IPv6 时它起作用了。对于 ubuntu,这很简单,只需在内核参数中添加以下 3 行:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

and run sudo sysctl -p. Good luck ;)

并运行sudo sysctl -p。祝你好运 ;)

p.s. Don't forget to disable proxy server, set Active provider to Direct at General->Network connections.

ps 不要忘记禁用代理服务器,将 Active provider 设置为 Direct at General->Network connections。

回答by Vincenzo Cerbone

I had the samere problem with Indigo + Glassfish 3.1 plug-in accessing an already working local standalone glassfish instance (with username 'admin' and my own password set). Fortunately doing the following did the trick for me:

我在 Indigo + Glassfish 3.1 插件访问一个已经正常工作的本地独立 glassfish 实例(用户名“admin”和我自己的密码设置)时遇到了同样的问题。幸运的是,执行以下操作对我有用:

  • stop glassfish
  • delete osgi-cache content ( ${GLASSFISH_3.1HOME}/glassfish/domains/domain1/osgi-cache )
  • set my username ('admin' in my case) and reset passowrd (no password at all)
  • 停止玻璃鱼
  • 删除 osgi-cache 内容 ( ${GLASSFISH_3.1HOME}/glassfish/domains/domain1/osgi-cache )
  • 设置我的用户名(在我的情况下为“admin”)并重置密码(根本没有密码)

starting glassfish from within Indigo now works!

从 Indigo 中启动 glassfish 现在可以使用了!

回答by Ludo

If the server works outside Eclipse, triple check the registration data of this server (runtime +domain) in Eclipse itself. In fact, try a new eclipse workspace... Is this server secured with https?

如果服务器在 Eclipse 之外工作,请在 Eclipse 本身中三重检查此服务器的注册数据(运行时+域)。实际上,尝试一个新的 Eclipse 工作区...该服务器是否使用 https 进行保护?