简体   繁体   English

如何使用Apache Tomcat Server运行Eclipse Dynamic Web Application?

[英]How to run an Eclipse Dynamic Web Application with Apache Tomcat Server?

I tried running Apache Tomcat Server on Eclipse and got into the following problems: 我尝试在Eclipse上运行Apache Tomcat Server并遇到以下问题:

  1. The Catalina_Base is using a temporary location! Catalina_Base正在使用临时位置!
  2. I couldn't deploy the dependencies "jar files"! 我无法部署依赖项“jar文件”!
  3. I got the following exception when running my web project: 运行我的Web项目时出现以下异常:
SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception [java.lang.AbstractMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;] with root cause java.lang.AbstractMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;

I managed to solve the above 3 problems by doing the following steps: 我设法通过执行以下步骤解决了上述3个问题:

1- Double click your server (tomcat in this case) [if you can't see it go to Windows -> Show/View -> Other -> Server -> Servers ]. 1-双击您的服务器(在本例中为tomcat)[如果您看不到它转到Windows -> Show/View -> Other -> Server -> Servers ]。 Your server name will look something like: "Tomcat v7.0 Server at localhost". 您的服务器名称类似于:“localhost上的Tomcat v7.0服务器”。

Double click the server and make sure the Server Locations is set to : "Use Tomcat installation (takes control of Tomcat installation)". 双击服务器并确保将服务器位置设置为:“使用Tomcat安装(控制Tomcat安装)”。 If you can't edit the servers location: Stop the server, right-click the server and select Publish . 如果无法编辑服务器位置:停止服务器, right-click the server and select Publish If still you cant edit it: 如果你仍然无法编辑它:

Right click the server --> Add and Remove and remove your project then publish it again. 右键单击服务器 - >添加和删除并删除项目,然后再次发布。

The reason for selecting "Use Tomcat installation" is that Catalina_Base will point to a temporary location and will look something like: 选择“使用Tomcat安装”的原因是Catalina_Base将指向一个临时位置,看起来像:

"-Dcatalina.base="C:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1"

This will cause a 404 Error even when trying to open Apache Tomcat Start Page. 即使在尝试打开Apache Tomcat Start Page时,这也会导致404错误。 When selecting "Use Tomcat Installation" the Catalina_Home and Catalina_Base values will be the same and both will point to the Tomcat Installation Directory: Example: 选择“使用Tomcat安装”时,Catalina_Home和Catalina_Base值将相同,并且两者都将指向Tomcat安装目录:示例:

-Dcatalina.base="C:\apache-tomcat-7.0.37" -Dcatalina.home="C:\apache-tomcat-7.0.37"

To see the Arguments: 要查看参数:

Double Click the Server then click on "Open launch configuration", the values will appear in the "Arguments" tab. 双击服务器,然后单击“打开启动配置”,这些值将显示在“参数”选项卡中。

2- When using dependencies (ex External Jar files), make sure the files are in : Web-Inf/lib and then add them to the class-path by doing the following: 2-使用依赖项(ex External Jar文件)时,请确保文件位于:Web-Inf / lib,然后通过执行以下操作将它们添加到类路径:

Right-click the project --> Build-path --> Configure Build Path Select the "Libraries" tab Click Add External JARs and select the jar files in Web-Inf/lib 右键单击项目 - >构建路径 - >配置构建路径选择“库”选项卡单击“添加外部JAR”,然后在Web-Inf / lib中选择jar文件

Next you need to deploy dependencies: To do this: 接下来,您需要部署依赖项:要执行此操作:

Right-Click the project -> Properties From the left side select "Deployment Assembly" On the right hand side click Add -> Java Build Path Entries -> Next Add all the jar files your project needs. 右键单击项目 - >属性从左侧选择“部署程序集”在右侧单击添加 - > Java构建路径条目 - >下一步添加项目所需的所有jar文件。

Otherwise, you'll get a class not found exception for the used jar files. 否则,您将获得使用过的jar文件的类找不到异常。

3- Make sure Web-Inf/lib does not contain any jar files from Apache Tomcat, as this will cause redundancies and will give the exception above! 3-确保Web-Inf / lib不包含来自Apache Tomcat的任何jar文件,因为这会导致冗余并且会给出上述异常!

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

相关问题 eclipse中的动态Web应用程序无法在apache服务器上运行 - Dynamic web application in eclipse cannot be run on apache server 如何使用Tomcat服务器在Eclipse中运行ExtJS 6应用程序 - How to run ExtJS 6 application in eclipse with tomcat server 运行Web Service Eclipse-Apache Tomcat 8 - Run web service eclipse - apache tomcat 8 Eclipse动态Web项目未在Tomcat服务器上运行 - Eclipse dynamic web project not running on tomcat server 配置Eclipse tomcat以运行多个Web应用程序 - Configure eclipse tomcat to run multiple web application 如何修复tomcat服务器无法运行我的动态Web项目? - How to fix tomcat server not run my dynamic web project? 应用程序将无法在Eclipse中的Tomcat服务器上运行 - Application will not run on Tomcat Server within Eclipse Apache Tomcat和Apache TomEE服务器未在Eclipse中运行Web项目 - Apache Tomcat and Apache TomEE server is not running web projects in eclipse SOLVED - HTTP Status 404 for Spring Web REST API after deploying dynamic application to Tomcat server on Eclipse - SOLVED - HTTP Status 404 for Spring Web REST API after deploying dynamic application to Tomcat server on Eclipse 在Apache Tomcat上永久部署Eclipse Java Dynamic Web项目 - Deploying Eclipse Java Dynamic web project on Apache Tomcat permanently
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM