How do I have weblogic reload cached JSPs on restart
Asked Answered
R

2

10

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).

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?

Repand answered 10/9, 2012 at 19:19 Comment(0)
S
6

Changing the JSP refresh timer

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.

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).

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

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>

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:

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.

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

Forcing redeployment

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]
  • 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.

  • 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.

Shinar answered 28/5, 2013 at 13:2 Comment(1)
I have the same issue. The page-check-seconds works fine when modifying the deployed JSP files directly. In the scenario described by @Repand though, where the server is shutdown and then the files are deployed, weblogic does not seem to notice that all/some of the files have changed and uses the generated classes instead.Hedgepeth
H
1

To avoid this you should first update your Module and then restart the server..this should fix your problem.

Although process mentioned by is always give 100% correctness. But you can try above mentioned steps.

Hotel answered 8/10, 2012 at 10:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.