Fast Swap in WebLogic 10.3 (and JDeveloper 11g) – redeploy after compile in running application

Lucas Jellema 6
0 0
Read Time:3 Minute, 47 Second


One of the cool new things I learned about here at the ODTUG 2009 conference is the fast swap feature in WebLogic Server 10.3 and above. So far, Application Server features have had limit use in my little development world, but this is one that may have quite some value for me, as I am developing my web applications in JDeveloper and constantly deploying, running and testing them. This feature will considerably shorten those development cycles!

The fast swap feature makes it possible to have classes that are changed and recompiled in JDeveloper immediately redeployed on WLS, without actually redeploying the entire application. By setting a single configuration option in a configuration file and configuring the output path for the compiler in JDeveloper I can shorten most of the development-compile-deploy-test cycles by eliminating the deploy (and application restart) step.

Note that there are some (minor) limitations to the type of changes that can be hot swapped. Also note that the fast swap only applies to class files – and not to one of the many XML files that are part of most web applications today. The fast swap has already been available much longer in the case the application was running in Debug mode (also known as hot redeploy). However, this type of hot redeploy is much more restrictive with regard to the code changes it will accept (only changes within methods).

So how does it work?

The simplest steps to see this feature in action are the following:

1. Start JDeveloper 11g

2. Create a new Web Application

3. Create a Servlet

Have the Servlet return some value

4. Configure the <fast-swap>  element in the weblogic.xml file:

* from the ViewController project node in the application navigator select the menu option New; select the General, Deployment Descriptors category and select on the right hand side the WebLogic Deployment Descriptor item.















* in the wizard that appears, select the option weblogic.xml and click Finish

* in the weblog.xml file that is now added to the project, add the following XML fragment:











5. Run the Servlet (which will compile the application, start WLS, deploy the application and start the browser with the URL where the application (servlet) can be accessed

See the result appearing in the browser

6. WebLogic Server will only be able to spot changed class files in the deployment directory where the web application has been exploded. You will have to locate the system11.\o.j2ee\drs directory (the exact number sequence after system can vary with the exact version you are using); in that directory, you will find a directory that is named as your web application is, and inside that directory there is a webapp directory that contains WEB-INF with a classes subdirectory. That classes directory (in my case that is system11.\o.j2ee\drs\WLSFastSwap\WLSFastSwap-ViewController-webapp\WEB-INF\classes) is where during deployment the application’s classes were deployed to and that is where WebLogic will check for hot swappable classes.

Now that you know the location of your (deployed) classes, change the Project Output Path for your ViewController project. From the context menu on the project, select Project Properties. Select the Project Source Paths node. On the bottom of the page that opens, you can set the Output Directory. Set it to the <long name>\WEB-INF\classes directory you discovered just before. Now any class gets compiled into that directory where it can be detected by WebLogic Server.

7. Change the result returned from the Servlet

Make some changes to the code in the Servlet Class to make it return a different value than before. Note: the fast swap not only applies to the Servlet Class but to any class that is deployed in your application.

8. Compile the Servlet

You may check whether the compiled class is written to the ‘exploded deployed’ classes directory. If you can see it appearing there, then so can WebLogic Server.

9. Refresh the browser => the new output is visible, even though we did not redeploy the web application



Note: there are some limitations for the changes that fast swap will support.


Documentation on WebLogic Server 10.3 – Fast Swap

About Post Author

Lucas Jellema

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld.
0 %
0 %
0 %
0 %
0 %
0 %

Average Rating

5 Star
4 Star
3 Star
2 Star
1 Star

6 thoughts on “Fast Swap in WebLogic 10.3 (and JDeveloper 11g) – redeploy after compile in running application

  1. Can someone please tel me if fastswap feature is possible on WLS in production mode?

  2. some people call it hot swap. it’s not proprietary with WLS, nor jDeveloper. It’s actually a feature called JDPA, since java 1.4.
    It helps a lot for developers.

  3. nice feature… to bad it doesn’t work 🙁
    ps: it works in debug mode i must say… but this ain’t new

  4. I’m wondering whether anyone got this working on OSX 10.5.7 (JDK 1.6.0_13)?

    Seems there’s an issue with the ClassRedefinerFactory:

    <Failure occurred in the execution of deployment request with ID ‘1246569437213’ for task ‘0’. Error is: ‘weblogic.application.ModuleException: Cannot initailize ClassRedefinerFactory’
    weblogic.application.ModuleException: Cannot initailize ClassRedefinerFactory
    at weblogic.servlet.internal.WebAppModule.loadFastSwapClassloader(
    at weblogic.servlet.internal.WebAppModule.prepare(
    at weblogic.application.internal.flow.ScopedModuleDriver.prepare(
    at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(
    at weblogic.application.internal.flow.DeploymentCallbackFlow$
    Truncated. see log file for complete stacktrace well-known file is not secure
    at Method)
    at com.bea.wls.redef.AttachUtils.findVirtualMachine(
    Truncated. see log file for complete stacktrace

  5. I understand how nice this feature is, but I personally prefer to start my app in debug mode and make the changes I need in any class and/or jspx file. Once you manually recompile the class you see the changes on your app. The only limitation on debug mode, is that you have to restart your app when adding new bindings to your page.

  6. This is a great feature when you have a huge app that take ages to redeploy!

    Moreover, a colleague of mine found out you aren’t required to configure anything in 11g, you just have to “make” (Ctrl-Shft-9) the class again and sometimes it works (e.g. changing code inside a function), sometime it won’t (e.g. renaming a function).

Comments are closed.

Next Post

Oracle Enhances XBRL Reporting Capabilities with UBmatrix, Inc.

Oracle posted a press release about their involvement and commitment for UBMatrix XBRL technologies last Wednesday saying (among others):"To help publicly held companies facilitate the preparation, publishing and automatic exchange of financial statements in XBRL (eXtensible Business Reporting Language), Oracle will embed UBmatrix, Inc.’s leading XBRL technology into Oracle's Enterprise Performance Management (EPM) System, Oracle announced today.""Oracle and UBmatrix are also working together to provide enterprise class storage and management for XBRL-based information in Oracle® Database 11g. Using Oracle Database’s XML DB feature, organizations can easily and quickly store, access and query their XBRL data."A lot of you might ask themselves: "Who are or what is UBMatrix ???" and how does it all fit in......more
%d bloggers like this: