java CLASS/JSP 文件实时部署
Oracle 10g 应用服务器,Java 1.5 + JSF(表示层)+ iBatis(数据库通信层)
在我目前工作的地方,有时需要对部署目录进行一些小的调整。 我不否认这不是最佳实践(如果我在这个网站上停留足够长的时间,也许我最终会成为最糟糕实践的例子 - 但它也有好的一面:)
所以,三个基本的事情我们调整的是:
- 重新编译的 Java 类文件
- 修改 JSP 的
- 修改后的 XML 格式的 iBatis 查询“映射”
例如,当报告错误,并且客户端渴望继续纠正它时,我们对 java 文件进行更正,重新编译该类,并将生成的 .CLASS 文件复制到部署期间放置旧版本的位置。 同样,我们覆盖修改后的 JSP(我想应用程序服务器会神奇地理解新 JSP 何时到达,并根据需要重新编译它)。
在上述两种情况下,为了以防万一,我们还重新启动了应用程序服务器。 我从来没有尝试过看看这些更改是否会在不重新启动的情况下起作用 - 如果服务器以某种方式将类/JSP 缓存在内存中,情况就不会是这样。所以,这是我的第一个问题 - 类/JSP 文件中的更改是由应用程序服务器跟踪? 也许不需要重新启动?
对于 iBatis XML,我们已经看到新的查询是从更新的 XML 中获取的,并且不需要重新启动。 不过,有时在取消部署时,我们会看到一些 XML 文件保持锁定状态,这意味着 iBatis 缓存了某些内容(不确定是什么)。
我想知道,从长远来看,这些调整可能会如何影响系统的稳定性? 除了我们之外,这里的其他人也会做这样的事情吗?
Oracle 10g Application Server, Java 1.5 + JSF (presentation layer) + iBatis (database communication layer)
In the place where I work at the moment, there sometimes rises the necessity to do small tweaks to the deployment directory. I don't deny that it's not the best practice (if I stay long enough on this site maybe I'll end up the example of the worst practices in general - but there are good sides to it too :)
So, three basic things we tweak with are:
- recompiled Java class files
- modified JSP's
- modified iBatis query "maps" in XML format
For example, when a bug is reported, and the client is eager to get on with it being corrected, we make the correction to the java file, recompile the class, and copy the resulting .CLASS file to wherever the old version was placed during the deployment. Likewise, we overwrite modified JSP's (I suppose that the application server magically understands when a new JSP has arrived, and recompiles it as necessary).
In the above two cases, just as a precaution, we also restart the Application Server. I have never tried to see if the changes would work without restarting - if the server somehow caches the classes/JSPs in memory this wouldn't be the case.. So, that's my first question - are the changes in class/JSP files are tracked by the application server? maybe restart is not necessary?
In case of iBatis XML's, we have seen that new queries are taken from updated XMLs, and no restarting is necessary. Still, sometimes while undeploying, we have seen that some XML files stay locked, meaning that iBatis caches something (not sure what).
I was wondering, in the long run, how these tweaks may influence the stability of the system? Do other people apart from us here do stuff like that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们的生产服务器上有 Apache Tomcat,JSP 可以毫无问题地替换,服务器将读取新页面而无需重新启动。
像 .properties、ibatis .xml、.class 这样的文件不能以这种方式使用,据我所知这需要在 Tomcat 上重新启动。
We have Apache Tomcat on our production servers, JSPs can be replaced without problem, the server will read the new page without a restart.
Files like .properties, ibatis .xml, .class cannot be used in this way, as far as I know this require a restart on Tomcat.