java Tomcat 7 war文件部署
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13794836/
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
Tomcat 7 war file deploy
提问by bali208
I am trying to load a WAR file to my Tomcat 7, and I am using eclipse to start or stop the Server.
我正在尝试将 WAR 文件加载到我的 Tomcat 7,并且我正在使用 eclipse 来启动或停止服务器。
I pasted the war file in TOMCAT_HOME/webapps folder and I started the server.
我将 war 文件粘贴到 TOMCAT_HOME/webapps 文件夹中,然后启动了服务器。
The server Started fine and i got the below console message.
服务器启动良好,我收到以下控制台消息。
10 Dec, 2012 9:10:46 AM 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: F:\Program Files\Java\jdk1.6.0_37\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;F:/Program Files/Java/jre6/bin/client;F:/Program Files/Java/jre6/bin;F:/Program Files/Java/jre6/lib/i386;C:\Program Files\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Windows Live\Shared;C:\Program Files\QuickTime\QTSystem\;.;F:\Program Files\Java\jdk1.6.0_37\bin;F:\apache-maven-3.0.4\bin;;F:\eclipse-juno;;.
10 Dec, 2012 9:10:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8090"]
10 Dec, 2012 9:10:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
10 Dec, 2012 9:10:46 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 484 ms
10 Dec, 2012 9:10:46 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
10 Dec, 2012 9:10:46 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.33
10 Dec, 2012 9:10:46 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8090"]
10 Dec, 2012 9:10:46 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
10 Dec, 2012 9:10:46 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 211 ms
But when i try to access my application it gave me ERROR 404, File not Found.
但是当我尝试访问我的应用程序时,它给了我错误 404,找不到文件。
I checked the application TOMCAT_HOME/webapps there i found both my war file and a folder of same name - "JavaServerFaces"
我检查了应用程序 TOMCAT_HOME/webapps 在那里我找到了我的War文件和一个同名的文件夹 - “JavaServerFaces”
TOMCAT_HOME/webapps directory :
TOMCAT_HOME/webapps 目录:
The Server is ON, war file is present, A folder structure is generated, but still i am not able to access my application which gives
HTTP Status 404 - /JavaServerFaces/xhtml/hello.xhtml
服务器已打开,存在War文件,生成了文件夹结构,但我仍然无法访问我的应用程序
HTTP Status 404 - /JavaServerFaces/xhtml/hello.xhtml
Any solutions for proper deployment and running of war file on tomcat 7?
在tomcat 7上正确部署和运行war文件的任何解决方案?
采纳答案by bali208
There is problem with tomcat to start or stop with eclipse. Its best to start and stop tomcat with the bat files in bin folder.
tomcat用eclipse启动或停止有问题。最好使用bin文件夹中的bat文件启动和停止tomcat。
回答by pmverma
In your console message, I do not find the deploying of "JavaServerFaces.war". In eclipse, open your server setting file,under "Server Location " check if the option "Use tomcat installation (.......) ". if it is checked, then check the deploy name if it "webapps". if not then, change it to "webapps".
在您的控制台消息中,我没有找到“JavaServerFaces.war”的部署。在eclipse中,打开你的服务器设置文件,在“服务器位置”下检查是否有“使用tomcat安装(......)”选项。如果选中,则检查部署名称是否为“webapps”。如果没有,请将其更改为“webapps”。
And if, this all are correct, then possibly your .war file is making fault.
如果这一切都是正确的,那么可能是您的 .war 文件出错了。
回答by Yeshdeep Kumar
There are 3 steps to find error
有3个步骤可以找到错误
1) copy the folder name which contains all application file and paste it into url. Now copy your servlet application url from web.xml and paste after folder name. If that works that means your Servlet application have some error..see the server console
1) 复制包含所有应用程序文件的文件夹名称并将其粘贴到 url 中。现在从 web.xml 复制您的 servlet 应用程序 url 并粘贴到文件夹名称之后。如果这有效,则意味着您的 Servlet 应用程序有一些错误..请参阅服务器控制台
2)On clicking on your application name in Manager App, and then your html file didn't run then there must be error in you your xml file try to rename your html file to index.xhtml
2)在Manager App中单击您的应用程序名称,然后您的html文件没有运行,那么您的xml文件中一定有错误尝试将您的html文件重命名为index.xhtml
3)4** error shows that there is an error on xml or html file. while 5** series error shows there is error in your tomcat server.
3)4** 错误表示 xml 或 html 文件有错误。而 5** 系列错误显示您的 tomcat 服务器中存在错误。
回答by Ashutosh Srivastav
Check the server setting in your eclipse. Check where the Configuration path is pointing. Also notice the Server location. By default it's Workspace Metadata, so set it to Tomcat Installation in your case.
检查 eclipse 中的服务器设置。检查配置路径指向的位置。还要注意服务器位置。默认情况下它是工作区元数据,因此在您的情况下将其设置为 Tomcat 安装。