指定旧 Tomcat 应用程序的 WEB-INF 位置

发布于 2024-10-06 01:34:52 字数 1079 浏览 0 评论 0原文

我正在尝试为旧版 Apache/Tomcat 应用程序构建测试设置。老实说,我不确定这是否是一个“应用程序”。它是恰好位于某个目录中的 JSP 的集合。

jsp 已正确显示。问题是未找到 WEB-INF 文件夹中的类文件夹 - 我收到 NoClassDefFoundError 异常。

让事情变得复杂的是,有两个“应用程序”并且它们共享一个 WEB-INF:

4 drwxr-xr-x    8 root     root         4096 Dec  2 09:38 thing1
4 drwxr-xr-x    8 root     root         8192 Dec  2 09:38 thing2
4 drwxr-xr-x    8 root     root         4096 Dec  2 09:38 WEB-INF

因此,在这个为您的理智进行清理的示例中,我们看到两个“应用程序”和共享的 WEB-INF文件夹。

一个有效的 URL 是 http://mysite/thing1/index.jsp 但是,当我们尝试从该页面登录时,我们会收到 NoClassDef 错误。

这是 server.xml 文件的相关部分。所以前面提到的index.jsp文件的实际路径是tony/ROOT/thing1/index.jsp

  <Host name="tony.com" appBase="tony/ROOT">
      <Alias>111.111.111.111</Alias>
      <Context path="" docBase="" debug="0" reloadable="true" crossContext="true" />
  </Host>

我的问题是,我该如何配置Tomcat,使thing1 & 2 使用 WEB-INF 作为他们的 lib 和 class 文件夹?这些“应用程序”没有被部署为战争文件......

(注意 - 制作生产框的副本会很困难 - 那里运行着很多东西。我正在尝试将其削减以创建一个测试环境一些应用程序。)

I am attempting to build a test setup for a legacy Apache/Tomcat application. To be honest, I am not sure if it is an 'application.' It is a collection of JSPs that happen to be in a certain directory.

The jsps are being displayed properly. The problem is that the classes folder in the WEB-INF folder isn't being found - I'm getting NoClassDefFoundError exceptions.

To complicate things, there are two 'apps' and they share a WEB-INF:

4 drwxr-xr-x    8 root     root         4096 Dec  2 09:38 thing1
4 drwxr-xr-x    8 root     root         8192 Dec  2 09:38 thing2
4 drwxr-xr-x    8 root     root         4096 Dec  2 09:38 WEB-INF

So in this sanitized-for-your-sanity example, we see the two 'applications' and the shared WEB-INF folder.

One URL that works is http://mysite/thing1/index.jsp When we try to log in from that page, however, we get the NoClassDef error.

Here's the relevant part of the server.xml file. So the actual path of the index.jsp file mentioned previously is tony/ROOT/thing1/index.jsp

  <Host name="tony.com" appBase="tony/ROOT">
      <Alias>111.111.111.111</Alias>
      <Context path="" docBase="" debug="0" reloadable="true" crossContext="true" />
  </Host>

My question is, how do I have to configure Tomcat so thing1 & 2 use WEB-INF for their lib and class folders? These 'apps' aren't being deployed as war files...

(note - making a copy of the production box would be difficult - there's a lot of stuff running there. I am attempting to pare it down to make a test environment for a few apps.)

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

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

发布评论

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

评论(1

泡沫很甜 2024-10-13 01:34:53

Web 应用程序必须具有以下结构:

tomcat/webapps/appname
tomcat/webapps/appname/*.jsp
tomcat/webapps/appname/WEB-INF
tomcat/webapps/appname/WEB-INF/lib
tomcat/webapps/appname/WEB-INF/classes

这样它就可以工作,无需任何额外的 xml 配置

A web application must have the following structure:

tomcat/webapps/appname
tomcat/webapps/appname/*.jsp
tomcat/webapps/appname/WEB-INF
tomcat/webapps/appname/WEB-INF/lib
tomcat/webapps/appname/WEB-INF/classes

So that way it should work, without any additional xml configurations

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