简体   繁体   English

如何从Eclipse(运行时环境配置)运行现有的Apache Tomcat实例?

[英]How to run existing apache tomcat instance from eclipse (runtime environment configuration)?

I have a general question which challenges my understanding of web applications as I only recently began to work with web apps. 我有一个普遍的问题,因为我直到最近才开始使用Web应用程序,这对我对Web应用程序的理解提出了挑战。

To simplify - I have a maven project which can be successfully installed using mvn clean install and then it can be started executing catalina start from the 'apache-tomcat/bin' folder using command line. 为了简化-我有一个Maven项目,可以使用mvn clean install成功安装它,然后可以使用命令行从'apache-tomcat / bin'文件夹开始执行catalina start At this point I will also add that localhost is accessible and working nicely. 在这一点上,我还将添加localhost是可访问的并且运行良好。

The goal is to do the same using eclipse. 目标是使用Eclipse进行相同的操作。 I can successfully install maven project from eclipse but I cannot start the server - or rather - I can start the server but it's not working properly. 我可以从eclipse成功安装maven项目,但是我无法启动服务器-或更确切地说-我可以启动服务器,但无法正常工作。

The way I try to start server from eclipse is I add a runtime environment (Windows->Preferences->Runtime Environmentss: tomcat 7), which points to the tomcat root folder /target/apache-tomcat (please note 'target' folder was created as result of installing/building maven project). 我尝试从Eclipse启动服务器的方式是添加一个运行时环境(Windows-> Preferences-> Runtime Environments:tomcat 7),该环境指向tomcat根文件夹/target/apache-tomcat (请注意,“ target”文件夹是由于安装/构建Maven项目而创建的)。 At the end I change configuration path (set to apache-tomcat/conf ) in 'Overview' tab in eclipse as well as I tick 'use custom location' radio button, pointing to 'apache-tomcat' folder. 最后,我在Eclipse的“概述”选项卡中更改了配置路径(设置为apache-tomcat/conf ),并勾选了“使用自定义位置”单选按钮,指向“ apache-tomcat”文件夹。

As the result server started but when trying to access localhost, instead of 'home-page' there is exception thrown: 结果服务器启动后,当尝试访问localhost而不是“主页”时,将引发异常:

java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target org.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:295) org.jasig.cas.client.validation.AbstractCasProtocolUrlBasedTicketValidator.retrieveResponseFromServer(AbstractCasProtocolUrlBasedTicketValidator.java:33) org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:178) org.springframework.security.cas.authentication.CasAuthenticationProvider.authenticateNow(CasAuthenticationProvider.java:131) org.springframework.security.cas.authentication.CasAuthenticationProvider.authenticate(CasAuthenticationProvider.java:117) org.springframework.security.authentication.ProviderManager.doAuthentication(ProviderManager.java:130) org.springframework.security.authenticatio java.lang.RuntimeException:javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求的目标org.jasig的有效证书路径。 cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:295)org.jasig.cas.client.validation.AbstractCasProtocolUrlBasedTicketValidator.retrieveResponseFromServer(AbstractCasProtocolUrlBasedTicketValidator.Java:33.org.jasig.Base.valid。 AbstractUrlBasedTicketValidator.java:178)org.springframework.security.cas.authentication.CasAuthenticationProvider.authenticateNow(CasAuthenticationProvider.java:131)org.springframework.security.cas.authentication.CasAuthenticationProvider.authenticate(CasAuthenticationProvider.java:117)org.springframework。 security.authentication.ProviderManager.doAuthentication(ProviderManager.java:130)org.springframework.security.authenticatio n.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:48) org.springframework.security.cas.web.CasAuthenticationFilter.attemptAuthentication(CasAuthenticationFilter.java:111) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381) org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:110) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) org.springframework.security.web.FilterChainProxy$V n.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:48)org.springframework.security.cas.web.CasAuthenticationFilter.attemptAuthentication(CasAuthenticationFilter.java:111)org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java: 199)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:381)org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:110)org.springframework.security.web。 FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:381)org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy。 java:381)org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)org.springframework.security.web.FilterChainProxy $ V irtualFilterChain.doFilter(FilterChainProxy.java:381) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) irtualFilterChain.doFilter(FilterChainProxy.java:381)org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:381) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy。 Java:167)

Obviously eclipse overridden somehow tomcat launch configuration but I don't know why. 显然,Eclipse覆盖了tomcat启动配置,但是我不知道为什么。 I'd appreciate any input! 我将不胜感激!

@update : Although I tried everything @skomisa suggested so far, it doesn't seem to work. @update :尽管到目前为止我尝试了所有@skomisa建议的操作,但它似乎没有用。 Interesting enough, that I can run the server via command prompt (eg 'catalina run' from tomcat bin directory, once it's built), but I cannot run it inside eclipse as following exception is thrown. 足够有趣的是,我可以通过命令提示符运行服务器(例如,一旦建立,便从tomcat bin目录中的“ catalina run”),但是由于出现以下异常,因此我无法在eclipse中运行它。 I do not access local host via HTTPS, but HTTP. 我不是通过HTTPS访问本地主机,而是通过HTTP访问。 Is that because in 'Add and Remove' window there are no web applications to deploy? 那是因为在“添加和删除”窗口中没有要部署的Web应用程序吗? At this point I will add, that my eclipse project is simply of Maven nature (it's not converted to dynamic web project, and I'm not sure if it has to be in order to successfully run tomcat). 在这一点上,我要补充一点,我的Eclipse项目只是Maven性质的(它不会转换为动态Web项目,并且我不确定是否必须成功运行tomcat)。

Add your Tomcat server to Eclipse as follows: 如下所示将您的Tomcat服务器添加到Eclipse:

  • Window -> Show View -> Servers 窗口->显示视图->服务器
  • In the Servers panel right-click in any empty area and select New -> Server 在“ 服务器”面板中,右键单击任何空白区域,然后选择“ 新建”->“服务器”
  • In the New Server wizard that opens expand the Apache node in the list of servers and select the appropriate version of Tomcat. 在打开的“ 新服务器”向导中,展开服务器列表中的Apache节点,然后选择适当的Tomcat版本。 It's Tomcat v7.0 Server in your case. 您要使用的是Tomcat v7.0 Server Click Next . 单击下一步
  • On the next screen click the Browse button and navigate to your installation of Tomcat 7. Click Next . 在下一个屏幕上,单击“ 浏览”按钮并导航到您的Tomcat 7安装。单击“ 下一步”
  • On the Add and Remove screen add any web applications you want deployed on that Tomcat 7 server, and click Finish . 添加和删​​除屏幕上,添加要在该Tomcat 7服务器上部署的所有Web应用程序,然后单击完成
  • You should see your Tomcat 7 server on the list of servers in the Servers panel. 您应该在“ 服务器”面板中的服务器列表上看到Tomcat 7服务器。 Select it, right click and select Run from the popup menu. 选择它,右键单击并从弹出菜单中选择“运行” Tomcat will log to the console ( Window -> Show View -> Console ). Tomcat将登录到控制台( 窗口->显示视图->控制台 )。
  • Enter the URL for your application in the browser. 在浏览器中输入您的应用程序的URL。 That's it! 而已!

This tutorial may also be helpful: https://crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ 本教程也可能会有所帮助: https : //crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/

As an unrelated issue, the stack trace you posted suggests that you are entered an https URL when you should have entered an http URL. 作为一个不相关的问题,您发布的堆栈跟踪建议您在应该输入http URL的情况下输入https URL。 Is that the case? 是这样吗

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

相关问题 如何在Eclipse中添加apache-tomcat-7.0.53或apache-tomcat-8.0.5服务器运行时环境? - How to add apache-tomcat-7.0.53 or apache-tomcat-8.0.5 server runtime environment in eclipse? 从Eclipse中的项目中删除Apache TomCat运行时? - Removing the Apache TomCat runtime from a project in Eclipse? Eclipse的新服务器运行时环境中的列表中缺少Apache Tomcat v8.5图标 - Apache Tomcat v8.5 icon missing from list in Eclipse's New Server Run Time Environment 如何在Eclipse运行配置中取消设置环境变量? - How to unset an environment variable in Eclipse run configuration? "Apache Tomcat 9 未在 Eclipse 服务器运行时环境中显示" - Apache Tomcat 9 Not Showing in Eclipse Server Runtime Environments 从脚本或环境变量(Pydev)获取Eclipse运行配置参数 - Get eclipse run configuration arguments from script or environment variable (Pydev) 如何使用Apache Tomcat Server运行Eclipse Dynamic Web Application? - How to run an Eclipse Dynamic Web Application with Apache Tomcat Server? 如何在 eclipse gradle 项目的运行配置中设置环境变量? - How to set Environment variables in Run Configuration of an eclipse gradle project? 如何在Eclipse中运行Tomcat中的Maven项目 - How to run a Maven Project In Tomcat From Eclipse Apache tomcat 错误(没有来自 eclipse 或 xampp tomcat) - Apache tomcat error (no from eclipse or xampp tomcat)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM