Hot deployment in Weblogic - modifying JSP, java classes without restarting

Hot deployment in Weblogic - modifying JSP, java classes without restarting

 Weblogic allows deploying new versions of components while wls is running. This process is called hot deployment. Because the Java classloader does not have any mechanism for unloading a set of existing classes, nor can it replace an old version with a new version of a class, in order to update related classes in a running virtual machine, the classloader must be replaced. When it is replaced, all classes loaded by it and derived child classloaders are also reloaded. All instances of these classes must also be reloaded. In wls, each application component has a hierarchical classloaders, which are all subclasses of system classloader. This structure helps each application or part of an application to be reloaded independently without affecting other components. So as long as we understand this principle, similar confusion will be easily solved.
Recently, there are many debugging defects. Every time I debug and modify a little code, I need to restart weblogic.
A lot of time is wasted on modifying-compiling-restarting the service, which makes people feel very irritated. Finally found a solution, which is to perform hot deployment settings under weblogic.
The following is the weblogic hot deployment setting method, which is recommended to be used during the development process:
1. startWebLogic.cmd:
set STARTMODE=false to set to development mode, true to product mode
2. web.xml:





3. weblogic.xml:

<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN"

"http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">
<weblogic-web-app>
<session-descriptor>
<session-param>
<param-name>TimeoutSecs</param-name>
<param-value>1800</param-value>
</session-param>
</session-descriptor>

<jsp-descriptor>
<jsp-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</jsp-param>
<jsp-param>
<param-name>pageCheckSeconds</param-name>
<param-value>1</param-value>
</jsp-param>
</jsp-descriptor>

<container-descriptor>
<servlet-reload-check-secs>1</servlet-reload-check-secs>
</container-descriptor>

<context-root>/your-web</context-root>
</weblogic-web-app>
The default value of pageCheckSecond is 1, which means that the JSP page is checked every 1 second to check whether the JSP page has been modified and whether it needs to recompile.

After the system goes online, you need to modify the default value to -1, which means never check. One disadvantage of changing to -1 is that the modification of the page requires redeployment of the entire WEB application. servlet-reload-check-secs The default value of this parameter is also 1, every 1 second to check whether the servlet has been modified and needs to be recompiled. Here it is suggested to modify it to -1, which means never check.

Note: When publishing production, these two values ​​​​need to be set to -1, otherwise the efficiency will be affected.
4. Make sure that your servlet classes are not in your classpath which can cause this problem.
5. In the WLS console, in the Files page of the web app, set <Reload Period> to 1

 

Reprint address: http://hi.baidu.com/crsky2008/item/29053a0df904043af2eafc64

Guess you like

Origin blog.csdn.net/u012411159/article/details/14001711