eclipse 我可以使用 XAMPP 的 apache tomcat 来执行 java 动态 Web 项目吗?

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

Can I use XAMPP's apache tomcat to execute java Dynamic Web Project?

eclipseapachetomcatjakarta-eexampp

提问by user3773380

I am using eclipse and I have a Dynamic Web Project .

我正在使用 eclipse 并且我有一个动态 Web 项目。

To execute it I need apache tomcat 7.0.

要执行它,我需要 apache tomcat 7.0。

But I have already installed XAMPP server that include both apache web server & apache tomcat server.

但我已经安装了 XAMPP 服务器,其中包括 apache web 服务器和 apache tomcat 服务器。

How can I mount my java web app to XAMPP's apache tomcat server?

如何将我的 java web 应用程序挂载到 XAMPP 的 apache tomcat 服务器?

回答by moskito-x

There are 2 possibilities

有2种可能

Option 1

选项1

  • You have two tomcat server running
  • one inside eclipse and the XAMPP Tomcat
  • you have to give the XAMPP Tomcat another port number
    here we give it a new port (8090) and redirectPort (8444).
  • 你有两个 tomcat 服务器正在运行
  • 一个内部 Eclipse 和 XAMPP Tomcat
  • 你必须给 XAMPP Tomcat 另一个端口号,
    这里我们给它一个新端口 (8090) 和重定向端口 (8444)。

..XAMPP\tomcat\conf\server.xml

..XAMPP\tomcat\conf\server.xml



original

原来的

<Connector port="8080" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />

changed to

变成

<Connector port="8090" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8444" />

disadvantage you have to deploy the Web application 2 times

缺点你必须部署 Web 应用程序 2 次

  • 1 Eclipse deploy it to the eclipse Tomcat server
  • 2 Manually deploy it to your XAMPP Tomcat server.
  • 3 Manually start your XAMPP Tomcat server with ..XAMPP\catalina_start.bat
  • 4 Manually stop your XAMPP Tomcat server with ..XAMPP\catalina_stop.bat
  • 1 Eclipse 部署到eclipse Tomcat服务器
  • 2 手动将其部署到您的 XAMPP Tomcat 服务器。
  • 3 手动启动您的 XAMPP Tomcat 服务器 ..XAMPP\catalina_start.bat
  • 4 手动停止您的 XAMPP Tomcat 服务器 ..XAMPP\catalina_stop.bat

here Tomcat runs on 8090

这里 Tomcat 在 8090 上运行

enter image description here

在此处输入图片说明

Option 2Change Eclipse settings.

选项 2更改 Eclipse 设置。

  • Windows -> Show View -> Servers
  • In the servers view, right click and add new.
  • It will show a pop up containing many server vendors.
  • Under Apache select Tomcat v7.0 (Depending upon your downloaded server version).
  • In the run time configuration point it to the XAMPP Tomcat folder (....\XAMPP\tomcat)
  • Windows -> 显示视图 -> 服务器
  • 在服务器视图中,右键单击并添加新的。
  • 它将显示一个包含许多服务器供应商的弹出窗口。
  • 在 Apache 下选择 Tomcat v7.0(取决于您下载的服务器版本)。
  • 在运行时配置中将其指向 XAMPP Tomcat 文件夹 ( ....\XAMPP\tomcat)

Advantage

优势

  • You need in XAMPP settings to change nothing.
  • Eclipse deploy it for you.
  • 您需要在 XAMPP 设置中进行任何更改。
  • Eclipse 为您部署它。

Disadvantage

坏处

  • on shutdown Eclipse, it will also stop XAMPP Tomcat server
  • so you have to start and stop it manually with
  • ..XAMPP\catalina_start.bat
  • 在关闭 Eclipse 时,它​​也会停止 XAMPP Tomcat 服务器
  • 所以你必须手动启动和停止它
  • ..XAMPP\catalina_start.bat

回答by veera

just start tomcat from ur Xampp Cpanel and put URL in browser localhost:8080, instead localhost, see [below snapand below snap

只需从您的 Xampp Cpanel 启动 tomcat 并将 URL 放入浏览器 localhost:8080,而不是 localhost,请参阅 [下面 snap下面 snap

it will run http://localhostApache , http://localhost:8080tomcat

它将运行http://localhostApache , http://localhost:8080tomcat