开发者

WebLogic Virtual Directory Mapping Not Working

I am having a frustrating problem with virtual directory mapping in my very simple WebLogic 11g application. I installed WebLogic 11g OEPE, which installs WebLogic Server 10.35. I believe that this is installed correctly, because I am able to deploy a much more complicated application that is working fine...except for my issue with virtual directory mapping.

I want to access files from a directory outside of the web application, H:\Backup.

Here is my entire application, and these are my exact files.

wl_test/index.html

<html>
<head><title>WebLogic Test</title></head>

<body>
<h1>This is another new test<br>
</body>
</html>

wl_test/WEB-INF/web.xml

<web-app>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>

wl_test/WEB-INF/weblogic.xml

<weblogic-web-app>
    <virtual-directory-mapping>
         <local-path>H:/Backup/</local-path>开发者_运维百科
         <url-pattern>/files/*</url-pattern>
         <url-pattern>*.txt</url-pattern>
    </virtual-directory-mapping>
</weblogic-web-app>

When I access the HTML file, 'http://localhost:7002/wl_test/index.html', it loads perfectly fine.

However when I attempt to load either of the following two URLs, they both fail with a HTTP 404 error. And yes, both of those files, one.ini and asdf.txt exist in the H:\Backup directory.

  1. 'http://localhost:7002/wl_test/files/one.ini'
  2. 'http://localhost:7002/wl_test/asdf.txt'

What could be wrong with this trivial setup?

I'm beginning to think I don't understand how this is supposed to work.


I think I understand what has changed and how to fix everything.

There were two problems with the virtual directory mapping.

First, the local-path cannot be a MS-DOS SUBSTed drive. I don't understand why, but WebLogic doesn't like it.

Second, when the url-pattern contains a folder, like /files/*, that folder must exist in the local-path directory.

Both of these are allowed in the JRun server that this is being ported from.

Sigh, Randy Stegbauer


I think there is something a little goofy about the combination of multiple url-pattern elements. Here's a sample showing the shared 404 file from my archives.

Part of the NotFoundWeb.war/WEB-INF/web.xml looks like this:

<error-page>
<error-code>404</error-code>
<location>/error/404.html</location>
</error-page>

Part of the NotFoundWeb.war/WEB-INF/weblogic.xml looks like this:

<wls:virtual-directory-mapping>
<wls:local-path>d:\temp\notfound</wls:local-path>
<wls:url-pattern>*.html</wls:url-pattern>
</wls:virtual-directory-mapping>

I have a file on the file system: d:\temp\notfound\error\404.html

So at runtime when I type something like: http://localhost:7001/NotFoundWeb/somebadurl

I get the error page from the file system.


The generatedReports and /app/reports are local folders in the file system. This way, you can put any type of files inside the generated Reports folder:

<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">
    
<weblogic-web-app>
    <container-descriptor>
        <index-directory-enabled>true</index-directory-enabled>
    </container-descriptor>
    <virtual-directory-mapping>
         <local-path>/app/reports</local-path>
         <url-pattern>/generatedReports/*</url-pattern>
    </virtual-directory-mapping>
</weblogic-web-app>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜