Unable to access XML file from Virtual directory after editing the file

大兔子大兔子 提交于 2019-12-11 14:14:29

问题


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>

回答1:


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.

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.

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

sample weblogic.xml:

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

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

Cheers!



来源:https://stackoverflow.com/questions/16357473/unable-to-access-xml-file-from-virtual-directory-after-editing-the-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!