java - 从 weblogic 迁移到 tomcat : directory mapping

标签 java tomcat weblogic

<分区>

我正在尝试从 weblogic 迁移到 tomcat。 在 weblogic 中我有

<virtual-directory-mapping>
  <local-path>E:/internal</local-path>

例如我有mysite 项目。这意味着 localhost:8080/mysite/= E:/internal 我可以通过 localhost:8080/mysite/从 E:/internal 获取文件

localhost:8080/mysite/file.jsp

我整个项目使用:

src="<%=request.getContextPath()%>/file.jsp"

this article有一个如何将本地文件夹映射到 tomcat 的示例。

This
6. Now inside the above xml file put the following line: 
<context docbase="d:/images"></context>

对我不起作用。我改成了

(1) <Context  docBase="E:/internal"></Context>

它有效。但我有一个问题。例如我有 localhost:8080/mysite/about 页面。

当我使用(1)映射时

src="<%=request.getContextPath()%>/file.jsp" doesnt work because it returns mysite/file.jsp

当我尝试通过创建 mysite.xml 映射 mysite 时,项目没有启动,因为 mysite 是一个站点 url。

我该如何解决这个问题?

最佳答案

最好的办法可能是映射 E:\Internal 中的每个项目单独使用 aliases你的 <Context> 的属性(参见 http://tomcat.apache.org/tomcat-7.0-doc/config/context.html)。请注意,使用 /因为“别名路径”是不允许的,这就是为什么你必须映射 E:\Internal 中的每个项目。单独。

如果您可以为E:\Internal 使用特定的URL 空间会更好喜欢/internal/[something]并将整个目录映射为 alias ,但这对您的项目来说可能不可行。

如果你真的想“合并”这两个目录(也就是说,来自 E:\Internal CATALINA_BASE/webapps/mysite 的资源都可以通过像 /mysite/foo 这样的 URL 获得,那么你将不得不使用像这样的 VirtualDirContext:

<Context>
    <Resources className="org.apache.naming.resources.VirtualDirContext"
      extraResourcePaths="/=E:\Internal" />
</Context>

(参见 http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Virtual_webapphttp://tomcat.apache.org/tomcat-7.0-doc/config/resources.html#VirtualDirContext_implementation)。

关于java - 从 weblogic 迁移到 tomcat : directory mapping,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20400465/

相关文章:

Java - 图像识别

mysql - Insert Into 添加双记录MySQL语句

java - Tomcat 在所有新部署的 WAR 文件上报告 404 错误?

Weblogic 12.2.1 托管服务器 access.log 未更新

servlets - 每个 webapp 模块的 weblogic 客户端证书身份验证

java - WebLogic 12c升级错误: Ensure that the annotations are valid.错误是org.apache.taglibs.standard.tag.el.core.WhenTag

java - 如果在 Windows Server 2016 上以非管理员身份运行,exit/b 0 在 process.exitValue 中返回 1

java - Hibernate/persistence 有哪些常见问题?

java - Facebook Graph API : querying/me/photos works fine, 但/me/photos?limit=100 返回错误

java - RedHat 上的 tomcat 6 内存不足,但在 debian 中没有