Java 无法在 Eclipse Indigo 中启动 Tomcat 7.0

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

Unable to Start Tomcat 7.0 in Eclipse Indigo

javaeclipsetomcattimeout

提问by Ahmed

I've to start working on a web-app project for which I've Eclipse Indigo and Tomcat 7.0 installed. The environment also has JRE 7, Android SDK in it. But whenever I start the server, it gets timed out!

我必须开始处理一个安装了 Eclipse Indigo 和 Tomcat 7.0 的 Web 应用程序项目。该环境还包含 JRE 7、Android SDK。但是每当我启动服务器时,它就会超时!

Moreover, I'm able to start the server outside Eclipse and sucessfully execute a web app in the browser. But to debug, I would rather have it in Eclipse.

此外,我能够在 Eclipse 之外启动服务器并在浏览器中成功执行 Web 应用程序。但是为了调试,我宁愿在 Eclipse 中使用它。

The error message is:

错误信息是:

Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.

In the console I get:

在控制台中我得到:

    Mar 14, 2012 11:51:18 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\program files\Java\jre7\bin;C:\WINNT\Sun\Java\bin;C:\WINNT\system32;C:\WINNT;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\oracle\product.1.0\BIN\;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Executive Software\Diskeeper\;C:\Program Files\Pointsec\Pointsec Media Encryption\Program\;C:\Program Files\Windows Imaging\;C:\oracle\product.1.0\BIN;C:\Program Files\Reflection\;C:\eclipse;;.
Mar 14, 2012 11:51:18 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:AUDI_ASSIST_v2.0_WS_REDESIGN_Interceptor' did not find a matching property.
Mar 14, 2012 11:51:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-9080"]
Mar 14, 2012 11:51:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-9009"]
Mar 14, 2012 11:51:18 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 504 ms
Mar 14, 2012 11:51:18 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 14, 2012 11:51:18 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
Mar 14, 2012 11:51:18 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [109] milliseconds.
Mar 14, 2012 11:51:18 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\documents and settings\fahmf\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\AUDI_ASSIST_v2.0_WS_REDESIGN_Interceptor\WEB-INF\lib\com.ibm.ws.webservices.thinclient_7.0.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Mar 14, 2012 11:51:20 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9080"]
Mar 14, 2012 11:51:20 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-9009"]
Mar 14, 2012 11:51:20 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1697 ms

I have tried the solutions proposed in other questions on this forum like increasing the time out period,changing the port numbers, uninstalling & reinstalling Tomcat, changing the 'publisiing' option for the server but nothing seems to work.

我已经尝试了该论坛上其他问题中提出的解决方案,例如增加超时时间、更改端口号、卸载并重新安装 Tomcat、更改服务器的“发布”选项,但似乎没有任何效果。

Any help would be sincerely appreciated. Thanks in advance...

任何帮助将不胜感激。提前致谢...

采纳答案by Venkat

Just follow the Simple Steps

只需按照简单的步骤

Double click on your desired server in the server-view , It will open the window and Right corner of the Window Timout option is availble and change time to 120 . it will work :)

在服务器视图中双击您想要的服务器,它将打开窗口,并且窗口超时选项的右上角可用并将时间更改为 120 。它会起作用:)

回答by SalmanMalik

Eclipse WTP usually tries to make sure that the web app is up by visiting the default page (/) of the app when you start the server. Until it gets an HTTP 200 (OK) response from that page - it thinks the app is not up. You are probably noticing the server icon (where you start tomcat from) still says "starting" with a green blinking.

Eclipse WTP 通常会在您启动服务器时通过访问应用程序的默认页面 (/) 来尝试确保 Web 应用程序已启动。直到它从该页面获得 HTTP 200 (OK) 响应 - 它认为应用程序没有启动。您可能注意到服务器图标(您启动 tomcat 的位置)仍然显示“正在启动”并闪烁绿色。

I think Eclipse has a bug where it cannot handle a bunch of 302 on the page at / - which could happen if that page was redirecting to another page which was again redirecting to a login page.

我认为 Eclipse 有一个错误,它无法处理 / 页面上的一堆 302 - 如果该页面重定向到另一个页面,而另一个页面又再次重定向到登录页面,则可能会发生这种情况。

回答by Stephane Manou

SOLVED: That's it!!!! For me was compiling with JDK6 but running Tomcat with JDK7, WST uses the system properties and not the eclipse settings. I also configure the same JDK Version in eclipse and in System (check it with java -version in cmd line)

已解决:就是这样!!!!对我来说,使用 JDK6 编译但使用 JDK7 运行 Tomcat,WST 使用系统属性而不是 eclipse 设置。我还在 eclipse 和 System 中配置了相同的 JDK 版本(在 cmd 行中使用 java -version 进行检查)

Details: I try to configure eclipse like describe here, but it didn′t solve the problem, then I notice in eclipse′s error log that tomcat was started with jre 1.7. in spite of my configurations.

详情:我尝试像这里描述的那样配置eclipse,但没有解决问题,然后我在eclipse的错误日志中注意到tomcat是用jre 1.7启动的。尽管我的配置。

I also try, in cmd line, 'java -version' and obtained '1.7' instead of expected '1.6'.

我还尝试在 cmd 行中使用“java -version”并获得“1.7”而不是预期的“1.6”。

I also decide to configure java 1.6 (like in eclipse) in system panel but it didn′t solve the problem. I also desinstall jre 1.7 restart eclipse AND IT SUCCESS!.. It was a very usefull clue, thank you.

我还决定在系统面板中配置 java 1.6(如在 eclipse 中),但它没有解决问题。我还卸载了 jre 1.7 重新启动 eclipse 并且它成功了!.. 这是一个非常有用的线索,谢谢。

回答by Vedran

For me the cause was Eclipse. Running the IDE with the '-clean' parameter solved it.

对我来说,原因是 Eclipse。使用“-clean”参数运行 IDE 解决了这个问题。

eclipse.exe -clean

回答by korro

You have to edit eclipse.ini and push to use Java 1.6

您必须编辑 eclipse.ini 并推送以使用 Java 1.6

-vm
c:\Program Files\Java\jdk1.6.0_25\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m

http://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example

http://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example

回答by Murali

Verify the deployment-descriptor and check the value for <url-pattern>. This can be stopping tomcat to load.

验证部署描述符并检查 的值<url-pattern>。这可能会停止 tomcat 加载。