如何使用共享 Tomcat?

发布于 2024-11-05 16:42:04 字数 950 浏览 0 评论 0原文

抱歉,我尝试搜索这个主题,但没有找到与我的问题相关的内容。 最近,我为其购买了域名和虚拟主机。我买它是为了将它用于我的 Java 项目。 我在主机上有 Tomcat 作为服务器。
我的问题是:如何使用托管 Tomcat,在我看来,它与 localhost(您可以无限制访问)有很大不同?


例如,如果我创建一个如下所示的 Spring 项目:

项目名称

<块引用>

源代码
战争

<块引用>

index.jsp
WEB-INF

<块引用>

web.xml

index.jsp 输出一个简单的 This is a test
web.xml

<欢迎文件列表>
  <欢迎文件>
     index.jsp
  

我创建了一个 Ant build.xml 来构建项目,但是当我从 http://domain.com/project-name 访问它时不起作用,我只能从 http://domain.com/project-name/war 访问该文件

如果我在本地主机上完成此操作,我会将其部署在 tomcat-path/ 中webapps,但是它如何在线运行呢?

Sorry, but I tried searching for this subject, but I didn't find related to my problem.
Recently, I bought a domain and web hosting for it. I bought it especially for using it for my Java projects.
I have Tomcat available as server on the hosting.
My question is: how do I work with a hosted Tomcat, which, in my opinion, it is quite different from localhost (where you could have unlimited access)?

For example, if I create a Spring project that looks like this:

project-name

src
war

index.jsp
WEB-INF

web.xml

The index.jsp outputs a simple This is a test
web.xml

<welcome-file-list>

   <welcome-file>

      index.jsp

   </welcome-file>

</welcome-file-list>

I created an Ant build.xml that will build the project, but when I access from http://domain.com/project-name it will not work, and I only cand access the file from http://domain.com/project-name/war

If I had done this on localhost, I'd deploy it in tomcat-path/webapps, but how does this work online?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

楠木可依 2024-11-12 16:42:04

解决方案是安装 Tomcat Manager Webapp,以便在使用 Tomcat 作为服务器的共享主机上部署应用程序。

编辑:
如果主机不为您提供 Tomcat Manager(就像我的情况一样),您仍然可以通过要求主机管理员配置您的 jk_mod 文件来部署您的 war 文件来完成任务。

追加这些行

jkMount /*.war ajp3
jkMount /* ajp3 ## 我仍然不确定这是否有效,因为它使 tomcat 监听整个 public_html

但请注意,如果您的 Tomcat 版本是由 cPanel 的 EasyApache 提供的,您也必须处理一些问题 - 最新安装的 Tomcat 将是 5.5.33 (有点旧,对吧?),但您可以再次尝试调整旧版本并安装,假设6.xx
关于本次升级的教程:

http://www.bestdesigns.co.in/blog/install- tomcat-6

这对我理解解决这个问题所涉及的概念有很大帮助:

http://www.scribd.com/doc/6085698/Tomcat - - 有关 Tomcat 和 cPanel 的培训课程

另外要补充的是:在您的计算机上安装本地版本的Tomcat,首先将其部署在本地主机上。如果它可以工作,它也应该可以在线工作。

那些在 Tomcat 5.5.33 上使用 Spring Roo 的人,如果您已经知道,您无法部署您的项目,因为 Tomcat 太旧了,所以你必须立即升级你的Tomcat。

我希望这能帮助所有像我一样有困难的人。

The solution is to install Tomcat Manager Webapp in order to deploy applications on a shared hosting that uses Tomcat as server.

EDIT:
If the hosting doesn't offer you Tomcat Manager (as was in my case), you can still make it through by asking the administrator of your hosting to configure your jk_mod file to deploy your war files.

Append these lines

jkMount /*.war ajp3
jkMount /* ajp3 ## I'm still not sure if this made it work, because it makes tomcat listen on the entire public_html

But be aware, if your version of Tomcat is brought to you by cPanel's EasyApache, you will have to deal with some issues there too - the latest installed Tomcat will be 5.5.33 (a bit old, right?), but again you can try tweaking the old version and install, let's say 6.x.x
A tutorial about this upgrade:

http://www.bestdesigns.co.in/blog/install-tomcat-6

The thing that help me a lot to understand the concepts that were envolved in solving this problem:

http://www.scribd.com/doc/6085698/Tomcat -- a training course about Tomcat and cPanel

An another thing to add: Install a local version of Tomcat on your machine, first deploy it on localhost. If there it works, it should be working online as well.

Those of you who work with Spring Roo, on Tomcat 5.5.33, if you already know, you cannot deploy your projects, becase of the too old Tomcat, so you have to upgrade your Tomcat immediately.

I hope this will help all of those who had difficulties like myself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文