您的位置:首页 > 运维架构 > Tomcat

migrate from weblogic to tomcat: directory mapping--reference

2014-08-12 14:59 253 查看
Question:

I am trying to migrate from weblogic to tomcat. in weblogic I have

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

For example I have mysite project. It means that localhost:8080/mysite/ = E:/internal and I can get a file from E:/internal through localhost:8080/mysite/

localhost:8080/mysite/file.jsp

I whole project is used:


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


In this article there is an examle how to map local folder to tomcat.

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

doesnt work for me. I changed it to

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

It works. But I have a problem. For example I have localhost:8080/mysite/about page.

When I use (1) mapping


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


when I try to map mysite by creating mysite.xml the project is not starting because mysite is a site url.

How can I resolve this problem?

Answer:

The best thing is probably to map each item in
E:\Internal
individually using the
aliases
attribute of your
<Context>
(see http://tomcat.apache.org/tomcat-7.0-doc/config/context.html). Note that using
/
as an "alias path" is not allowed, which is why you'd have to map each item in
E:\Internal
individually.

It would be better if you could use a particular URL space for
E:\Internal
like
/internal/[something]
and map the whole directory as an
alias
, but that might not be feasible for your project.

If you really want to "merge" the two directories (that is, resources from both
E:\Internal
and
CATALINA_BASE/webapps/mysite
are available via URLs like
/mysite/foo
, then you will have to use the VirtualDirContext like this:

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

(See http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Virtual_webapp andhttp://tomcat.apache.org/tomcat-7.0-doc/config/resources.html#VirtualDirContext_implementation).

原文地址:http://stackoverflow.com/questions/20400465/migrate-from-weblogic-to-tomcat-directory-mapping
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: