加载外部 xsd 和 dtd 使我的应用程序启动时间较长
我正在使用tiles和spring mvc开发一个web应用程序。通过对 spring mvc 的tiles和bean声明的定义使用xsd和dtd验证,每次启动/重新启动Web应用程序时,都会将请求发送到外部服务器以获取xsd和dtd文件。我注意到,因为我的 web 应用程序由于对外部服务器的请求失败而无法随意启动(!!!)。 我想知道是否有办法告诉我的应用程序停止这样做?比如将这些文件的缓存版本放在某处,或者告诉 Xml 处理器在运行时无效这些 xml 文件?
I'm developing a webapp using tiles and spring mvc. With the use of xsd and dtd validation on the definition of tiles and bean declaration of spring mvc, each time the web app is start/restart, then requests are sent to external server for xsd and dtd files. I notice that because my webapp failed to start casually due to failed request to external server (!!!).
I wonder if there is a way to tell my app to stop doing that? Like place a cached version of these files somewhere, or tell the Xml Processor to not valid these xml files at run time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我面临着类似的问题(但涉及 xsd 文件。)经过一点研究后,通常情况下,foo-1.0.jar 将包含 foo-schema-1.0.xsd,因此当 foo 去验证其 foo-config.xml 时,它不需要向 Internet 请求 xsd。
当您升级到 foo-1.1.jar(其中包括新的 foo-schema-1.1.xsd)而不更改 foo-config.xml 以引用新版本的架构时,就会出现问题。 foo-1.1.jar 不包含 foo-schema-1.0.xsd,因此解析器在 Internet 上查找它。如果尝试查看的网站已关闭,则说明有问题。
因此,请检查您的 xml 文件,确保它们引用的 xsd/dtd 版本适合验证它们的 jar 版本。
I'm facing a similar problem (but with xsd files.) After a little research, it appears that generally, foo-1.0.jar will contain foo-schema-1.0.xsd and therefore when foo goes to validate its foo-config.xml, it doesn't need to ask the Internet for the xsd.
The problem comes when you upgrade to foo-1.1.jar (which includes the new foo-schema-1.1.xsd) without changing your foo-config.xml to reference the new version of the schema. foo-1.1.jar doesn't contain foo-schema-1.0.xsd, so the parser looks for it on the Internet. If the site is trying to look at is down, you have problems.
So check your xml files to make sure they're referencing the version of the xsd/dtd appropriate for the jar version which is validating them.