简体   繁体   English

Eclipse:Glassfish 和 Tomcat 不起作用

[英]Eclipse: Glassfish and Tomcat don't work

I have reinstalled java JDK 6.0.25,(after some problems installing java, finally succeeded).我已经重新安装了 java JDK 6.0.25,(在安装 java 出现一些问题后,终于成功了)。 I have set paths (JAVA_HOME points to C:\Program Files\Java\jdk1.6.0_25 and in Path also added C:\Program Files\Java\jdk1.6.0_25\bin).我已经设置了路径(JAVA_HOME 指向 C:\Program Files\Java\jdk1.6.0_25 并且在路径中还添加了 C:\Program Files\Java\jdk1.6.0_25\bin)。

In eclipse I have pointed everything to this new JDK, also in servers.在 eclipse 中,我将所有内容都指向了这个新的 JDK,也在服务器中。 When I have installed Glassfish 3.1, after installation the domain wasn't created.当我安装 Glassfish 3.1 时,安装后域没有创建。 So when I add this server in Eclipse, the domain wasn't found.因此,当我在 Eclipse 中添加此服务器时,找不到域。

So I did extract an ZIP version of Glassfish and in Eclipse configure the server to this ZIPPED Glassfish.所以我确实提取了 Glassfish 的 Z4348F938BDDDD8475E967CCB47ECB234Z 版本,并在 Eclipse 中将服务器配置为这个 ZIPPED Glassfish。 Also I have installed tomcat 7.0.14 again and add to eclipse but both did not work.我也再次安装了 tomcat 7.0.14 并添加到 eclipse 但两者都没有工作。

Main problem: When I start Tomcat or Glassfish in Eclipse they don't start.主要问题:当我在 Eclipse 中启动 Tomcat 或 Glassfish 时,它们没有启动。 Tomcat is starting but after 45 seconds it says, that the time is run out. Tomcat 正在启动,但 45 秒后它说时间用完了。 I have read the forums to increase starting time, I have putted it to 240 sec, but it does not work, because it pop out error in which sazs, that the port is already used by a different server.我已阅读论坛以增加启动时间,我已将其设置为 240 秒,但它不起作用,因为它在 sazs 中弹出错误,表明该端口已被不同的服务器使用。

By Glassfish, when I start it, its starting, but after few minutes gives me error: Failed to start. Glassfish,当我启动它时,它启动了,但几分钟后给我错误:启动失败。 It looks like some ports or something is blocking this servers.看起来某些端口或某些东西正在阻止此服务器。 I have turned off firewall also and antivirus but nothing.我也关闭了防火墙和防病毒软件,但什么也没有。

I have looked all the forum about "not starting Glassfish or Tomcat" but didn't found the solution.我查看了所有关于“不启动 Glassfish 或 Tomcat”的论坛,但没有找到解决方案。 I don't want to reinstall windows for this.我不想为此重新安装 windows。 So if anyone know anything about this problem, please HELP.因此,如果有人对此问题有所了解,请帮助。

Update:更新:

I've tried to change the ports in domain.xml and checked with netstat -b (everything was established), but the server (Glassfish) didn't start.我尝试更改 domain.xml 中的端口并使用 netstat -b 检查(一切都已建立),但服务器(Glassfish)没有启动。 It shows an error "Server GlassFish Server Open Source Edition 3 (Java EE 6) at localhost failed to start.".它显示错误“本地主机上的 Server GlassFish Server Open Source Edition 3 (Java EE 6) 无法启动。”。 I've also tried install "built in Eclipse" Glassfish from marketspace and from "Install new software" from eclipse, but it comes out with the same error.我还尝试从市场空间和 eclipse 的“安装新软件”安装“内置 Eclipse”Glassfish,但出现相同的错误。 Currently, for needs I'm using XP Mode in Windows 7, there servers work, without any problems.目前,出于需要,我在 Windows 7 中使用 XP 模式,服务器可以正常工作,没有任何问题。

It seems your installation odyssey messed up your system.看来你的安装奥德赛搞砸了你的系统。

But you should get it working without reinstalling Windows.但是你应该在不重新安装 Windows 的情况下让它工作。 Maybe the fragment of an old server installation blocks the ports Glassfish and Tomcat need for operation.可能是旧服务器安装的片段阻塞了 Glassfish 和 Tomcat 运行所需的端口。

Try the following:尝试以下操作:

  1. Check which ports your "new" servers try to access (should be something like 8080 and should be written in server logs during startup)检查您的“新”服务器尝试访问哪些端口(应该类似于 8080,并且应该在启动期间写入服务器日志)

  2. Use netstat -b (from cmd started with admin rights) to check which application blocks this / these ports (could be java.exe if there is an old installation still hanging)使用netstat -b (从 cmd 开始,以管理员权限开始)检查哪些应用程序阻止了这个/这些端口(可能是 java.exe,如果旧安装仍然挂起)

  3. Remove the old installation (uninstall or disable service)删除旧安装(卸载或禁用服务)

  4. Try again to start your new server(s).再次尝试启动您的新服务器。

Try tell to GF or TC to bind the default web listener other port than 8080, because this is a root of problem.尝试告诉 GF 或 TC 将默认的 web 侦听器绑定到 8080 以外的端口,因为这是问题的根源。 I doesn't know well TC, but in GF case, this is very easy.我不太了解TC,但在GF的情况下,这很容易。 Simply edit $GLASSFISH_HOME/domains/domain1/config/domain.xml and find something similar:只需编辑 $GLASSFISH_HOME/domains/domain1/config/domain.xml 并找到类似的内容:

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

And replace 8080 with other port (but not same with TC).并将8080替换为其他端口(但与TC不同)。 In your case I could choose 8888 which is easy to remember but you can pretty sure this is differs from TC's port.在您的情况下,我可以选择容易记住的 8888,但您可以确定这与 TC 的端口不同。

Note: Edit this file before you start GF!注意:在启动 GF之前编辑此文件!

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

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