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

Share this on .. Tweet about this on TwitterShare on LinkedIn0Share on Facebook0Share on Google+0Email this to someoneShare on Tumblr0Buffer this page


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

Share this on .. Tweet about this on TwitterShare on LinkedIn0Share on Facebook0Share on Google+0Email this to someoneShare on Tumblr0Buffer this page

About Author

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, Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press books: Oracle SOA Suite 11g Handbook and Oracle SOA Suite 12c Handbook. Frequent presenter on community events and conferences such as JavaOne, Oracle Code and Oracle OpenWorld.


  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. George Maggessy on

    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. Jean-Philippe Melanson on

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