我如何让 weblogic 在重启时重新加载缓存的 JSP [英] How do I have weblogic reload cached JSPs on restart

查看:73
本文介绍了我如何让 weblogic 在重启时重新加载缓存的 JSP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们为 weblogic (11g) 部署新版本应用程序的方法是复制现有的 ear 文件,然后停止并重新启动 weblogic 服务器.我们启动/停止 weblogic 而不是重新部署,因为已知的 permgen 问题(最终我们将用完 perm gen 并且必须退回 weblogic 服务器).

Our method of deploying a new version of an app for weblogic (11g) is to copy over top of the existing ear file and then stop and restart the weblogic server. We do a start/stop of weblogic rather than a redeployment, because of the known permgen issue (where eventually we will run out of perm gen and have to bounce the weblogic server).

但是,这种部署方法有一个缺点——weblogic 看不到新的JSP 版本.为了解决这个问题,我们不得不在重新启动服务器之前清除 tmp 目录的内容,该目录维护已编译 JSP 的缓存.是否有设置会告诉 weblogic 在启动备份时擦除缓存/重新加载/重新编译 JSP?

However, this method of deploying has a drawback-- new JSP versions are not seen by weblogic. In order to fix this we have had to wipe out the contents of the tmp directory that maintain a cache of the compiled JSPs prior to restarting the server. Is there a setting that would tell weblogic to wipe the cache/reload/recompile JSPs when it starts back up?

推荐答案

更改 JSP 刷新计时器

标准的解决方案是通过在 web.xmlweblogic.xml 中设置值来告诉 Weblogic 更频繁地检查 JSP 新鲜度.

A standard solution is to tell Weblogic to check JSP freshness more frequently by either setting the value in your web.xml or in your weblogic.xml.

在生产模式下,Weblogic 不会在开发模式下每秒检查新的 JSP 版本(默认值:-1)(默认值:1).

In production mode, Weblogic won't check for new JSP versions (default value: -1) while it does each second in development mode (default value: 1).

选择修改 web.xml 还是 weblogic.xml 取决于您,关于您的目标应用服务器,是否仅是 WebLogic.

The choice between modifying web.xml or weblogic.xml is up to you, regarding the application servers you target, being WebLogic only or not.

如果您更喜欢修改 web.xml,则为上下文参数 weblogic.jsp.pageCheckSeconds 设置一个值,如下所示:

If you prefer to modify web.xml, then set a value for the context parameter weblogic.jsp.pageCheckSeconds as follows:

<context-param>
  <param-name>weblogic.jsp.pageCheckSeconds</param-name>
  <param-value>0</param-value>
</context-param>

如果您更喜欢修改weblogic.xml,请在jsp-descriptor 部分中为参数page-check-seconds 设置一个值.以下是文档的相关摘录:

If you prefer to modify weblogic.xml, then set a value for parameter page-check-seconds in the jsp-descriptor section. Here is the relevant excerpt from the documentation:

设置 WebLogic Server 检查 JSP 文件是否已更改并需要重新编译的时间间隔(以秒为单位).依赖项也会被检查并在更改时递归重新加载.值 -1 表示从不检查页面.这是生产环境中的默认值.值 0 表示始终检查页面.值 1 表示每秒检查页面.这是开发环境中的默认值.在很少更改 JSP 的生产环境中,请考虑根据您的调整要求将 pageCheckSeconds 的值更改为 60 或更大.

Sets the interval, in seconds, at which WebLogic Server checks to see if JSP files have changed and need recompiling. Dependencies are also checked and recursively reloaded if changed. The value -1 means never check the pages. This is the default value in a production environment. The value 0 means always check the pages. The value 1 means check the pages every second. This is the default value in a development environment. In a production environment where changes to a JSP are rare, consider changing the value of pageCheckSeconds to 60 or greater, according to your tuning requirements.

来源:http://docs.oracle.com/cd/E21764_01/web.1111/e13712/weblogic_xml.htm#i1038490

强制重新部署

重新启动 Weblogic 服务器不会强制它重新部署 Web 应用程序(尤其是在生产模式下).

Restarting Weblogic server does not force it to redeploy a Web Application (especially in production mode).

解决方案使用如下命令行显式触发重新部署"生命周期操作:

Solution Trigger explicitly the "redeploy" life-cycle operation using command line like this:

java -cp weblogic.jar weblogic.Deployer -redeploy [-remote -adminurl t3://hostname:hostport] -username login -password password -name webapp.name [-upload -source webapp.war]

  • 请注意,-redeploy-update 安全得多,尤其是.使用 Weblogic <= 10.x

    • Note that -redeploy is WAYS much safer than -update, esp. with Weblogic <= 10.x

      在 [ ] 之间保留第一个块,仅当服务器不在本地时.在这种情况下删除 [ ].

      Keep first block between [ ], only if the server is not local. Remove the [ ] in that case.

      在[ ]之间保留第二个块,如果您想合并在同一步骤中上传的WAR文件,这样更简单.在这种情况下删除 [ ].

      Keep second block between [ ], if you want to combine the WAR file uploading in the same step, which is way simpler. Remove the [ ] in that case.

      这篇关于我如何让 weblogic 在重启时重新加载缓存的 JSP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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