WebLogic虚拟目录映射不工作

WebLogic虚拟目录映射不工作,weblogic,Weblogic,我在非常简单的WebLogic11g应用程序中遇到了一个令人沮丧的虚拟目录映射问题。我安装了WebLogic 11g OEPE,它安装了WebLogic Server 10.35。我相信这是正确安装的,因为我能够部署一个工作正常的复杂得多的应用程序……除了我的虚拟目录映射问题 我想从web应用程序之外的目录H:\Backup访问文件 这是我的整个应用程序,这些是我的精确文件 wl\u test/index.html <html> <head><title>We

我在非常简单的WebLogic11g应用程序中遇到了一个令人沮丧的虚拟目录映射问题。我安装了WebLogic 11g OEPE,它安装了WebLogic Server 10.35。我相信这是正确安装的,因为我能够部署一个工作正常的复杂得多的应用程序……除了我的虚拟目录映射问题

我想从web应用程序之外的目录H:\Backup访问文件

这是我的整个应用程序,这些是我的精确文件

wl\u test/index.html

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

<body>
<h1>This is another new test<br>
</body>
</html>
<web-app>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>
<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>

网络逻辑测试
这是另一个新的测试
WLU测试/WEB-INF/WEB.xml

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

<body>
<h1>This is another new test<br>
</body>
</html>
<web-app>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>
<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>

index.html
WLU测试/WEB-INF/weblogic.xml

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

<body>
<h1>This is another new test<br>
</body>
</html>
<web-app>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>
<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>

H:/Backup/
/档案/*
*.txt

当我访问HTML文件时,'http://localhost:7002/wl_test/index.html,它的负载非常好

但是,当我尝试加载以下两个URL中的任何一个时,它们都会失败,并出现HTTP 404错误。是的,这两个文件one.ini和asdf.txt都存在于H:\Backup目录中

  • "http://localhost:7002/wl_test/files/one.ini"
  • "http://localhost:7002/wl_test/asdf.txt"
  • 这个琐碎的设置有什么问题


    我开始觉得我不明白这是怎么回事。

    我觉得多个url模式元素的组合有点愚蠢。下面是一个示例,显示了我的归档文件中的共享404文件

    NotFoundWeb.war/WEB-INF/WEB.xml的一部分如下所示:

    <error-page>
    <error-code>404</error-code>
    <location>/error/404.html</location>
    </error-page>
    
    <wls:virtual-directory-mapping>
    <wls:local-path>d:\temp\notfound</wls:local-path>
    <wls:url-pattern>*.html</wls:url-pattern>
    </wls:virtual-directory-mapping>
    
    
    404
    /错误/404.html
    
    NotFoundWeb.war/WEB-INF/weblogic.xml的一部分如下所示:

    <error-page>
    <error-code>404</error-code>
    <location>/error/404.html</location>
    </error-page>
    
    <wls:virtual-directory-mapping>
    <wls:local-path>d:\temp\notfound</wls:local-path>
    <wls:url-pattern>*.html</wls:url-pattern>
    </wls:virtual-directory-mapping>
    
    
    d:\temp\notfound
    *.html
    
    我在文件系统中有一个文件: d:\temp\notfound\error\404.html

    所以在运行时,当我键入以下内容时:


    我从文件系统中得到了错误页面。

    我想我知道发生了什么变化以及如何修复一切

    虚拟目录映射有两个问题

    首先,本地路径不能是MS-DOS子驱动器。我不明白为什么,但WebLogic不喜欢它

    其次,当url模式包含一个文件夹(如/files/*)时,该文件夹必须存在于本地路径目录中

    这两个都可以在从中进行移植的JRun服务器中使用

    唉,,
    Randy Stegbauer

    生成的报告和/app/报告是文件系统中的本地文件夹。这样,您可以将任何类型的文件放入“生成的报告”文件夹中:

    
    真的
    /应用程序/报告
    /生成报告/*
    
    嗯……我在另一个系统上安装了一台服务器,当然它工作得很好。于是我从我的开发工作站上卸下了服务器,重新安装了它,现在它也可以工作了。我现在应该删除这个问题吗?对不起。我不明白这个问题。我希望这个本地路径是动态的,我需要从我的java代码中更改本地路径。我不知道该怎么做,也不知道这是否可能。你是说从一个HTTP请求到下一个HTTP请求是动态的吗?我会考虑从操作系统本身的内部实现这一点的方法,可能是重命名文件夹或更改符号链接。如果可能的话。还要考虑创建一个新的堆栈溢出问题,以便其他人看到它。在我看了之后,我把它解决了。如果本地路径为H:/Backup/且url模式为/files/*,那么您应该在备份中创建一个“files”文件夹,Weblogic将在那里查找这些文件。谢谢!!!你是我今天的英雄。你的研究帮我解决了同样的问题。