编辑文件后无法从虚拟目录访问 XML 文件 [英] Unable to access XML file from Virtual directory after editing the file

查看:30
本文介绍了编辑文件后无法从虚拟目录访问 XML 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过虚拟目录访问一个 XML 文件,而 XML 保存在应用程序服务器上.最初解析工作正常,但是当我在 XML 中进行了一些更改之后,我无法访问该 XML 文件.在这种情况下,我需要重新启动服务,然后才能正常工作.

I am accessing an XML file through virtual directory and XML is kept at application server. Initially parsing was working fine but when I made some changes in XML after that I am not able to access that XML file. In that case I need to re-start the services then its working.

code : weblogic.xml

<wls:virtual-directory-mapping>
        <wls:local-path>/app/upload_files/</wls:local-path>
        <wls:url-pattern>/Banner/*</wls:url-pattern>
        <wls:url-pattern>/Login/*</wls:url-pattern>
        <wls:url-pattern>/Home/*</wls:url-pattern>
</wls:virtual-directory-mapping>

推荐答案

看起来您正在使用 resource-reload-check-secs 的默认值(生产模式下为 -1,开发模式下为 1).此参数控制资源元数据的缓存(如静态资源的文件大小等).-1 意味着永远不会重新加载元数据,因此即使您更改静态资源 WLS 也永远不会重新加载资源.

It looks like you you are using default value for resource-reload-check-secs (which is -1 in production mode and 1 in development mode). This parameter controls caching of resource metadata (like file size for static resources, etc). -1 means that never reload the metadata so even if you change the static resource WLS will never reload the resource afresh.

如果您的 XML 文件是这种情况,并且您的 XML 文件的大小发生了变化,如果新文件大小更大并且 XML 解析器会中断,WLS 最终会部分读取它,或者如果是新文件,则会给您一个 IO 异常文件大小较小.

And if this is the case for your XML file and if your XML file has changed in size, WLS would end up reading it partially if new file size is greater and XML parser would break, or give you an IO exception if new file size is lesser.

您可以尝试重新部署应用程序.

You can try re-delpoying the application.

或者如果您经常更改静态资源,那么您可以将 resource-reload-check-secs 的值更改为 0 或 1

Or if you frequently change the static resources then you may change value of resource-reload-check-secs to 0 or 1

示例 weblogic.xml:

sample weblogic.xml:

....
<container-descriptor>
<resource-reload-check-secs>0</resource-reload-check-secs>
</container-descriptor>
</weblogic-web-app>

参考:http://docs.oracle.com/cd/E15051_01/wls/docs103/webapp/weblogic_xml.html#wp1067857

干杯!

这篇关于编辑文件后无法从虚拟目录访问 XML 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆