The Great Migration

ADF Applications – Migration from 12.1.3 to 12.2.1

Hi all and welcome to a new article on Red Mavericks!

This article will present some problems and respective solutions in order to migrate ADF applications from 12.1.3 to 12.2.1. In this case, we used an example application that consists in a framework with several ADF applications and dependencies between them. In the current version (12.1.3), the framework works without issues.

ADF 12.2.1 comes with several corrections of customer-reported and internal (unpublished) errors, along with a new features that can be useful when developing applications:

  • Responsive Layout (Masonry Layout, af:matchMediaBehavior)
  • Visualization components (NBox, new charts and enhancements)
  • ADF Business Components (Creating RESTfull Web Services with Application Modules)

For more information about the changes in the ADF 12.2.1, click here to visit oracle documentation.

For clarify any misleading concept, I will assume the following meanings in this document:

  • Application: Group of ADF applications
  • ADF application: Group of ADF project
  • ADF project: Single ADF project

 

JDeveloper wizard migration

In order to do the migration to the new ADF version, we used the JDeveloper 12.2.1 to open all ADF projects and followed the steps in the migration wizard:

MigrationsStep1

MigrationsStep2

MigrationsStep3

Repeat this steps for every ADF projects in your application.

In this process, we did the initial migration required by the JDeveloper with success in all projects.

Advice – Debug Problems

In my migration case, I had several problems with ADF projects that contains declarative components.

In complex ADF applications with multiple dependencies is hard to know what is going on. So my advice is to try to start with simple ADF projects, with fewer dependencies, and then move on to the more complex ones. If there are declarative components that you can insert into a test ADF application to try them out, do it, and see if you can run the test or if there is a problem with it.

Validate, Update and Add ADF projects missing dependencies

For each ADF project you migrate to the new version,  check the libraries in the ADF project properties:

  1. Right click on the ADF project and select “Project Properties…” (our double click over the ADF project)projectDependenciesStep1
  2. Check all the libraries tabs, including Facelets Tag Libraries, JSP Tag Libraries and Libraries and Classpath:projectDependenciesStep3
  3. Sometimes JDeveloper doesn’t correctly migrate all libraries to the new versions. In this case, you need to remove the faulty libraries and add them manually.projectDependenciesStep4

Another aspect to take a quick look is the ADF Model projects. Sometimes during the ADF project migration, the ADF generates ViewController files in the Model project. My advice is to delete this new files using the window explorer because they can be a source of problems when trying to run your ADF application (refresh the application in JDeveloper after removing the files).

ADFModelStep1

ADFModelStep2

Also update the BPM, UCM and others libraries you have inside your ADF projects. To do this copy the libraries you need from your <oracle_home>/oracle_commom/modules, where <oracle_home> is the directory home where your jdeveloper 12.2.1 was installed.

BPM_UCM_libs

 

Then you have to check and update (in case the library has a different name) any of this libraries decencies inside your project properties.

Clean ADF projects before compile and deploy

In order to certify all the ADF project will compile using the new configurations, I recommend you to do the following steps:

  1. For each ADF project, go to “Build” menu and select “Clean All

projectClean

  1. You can also delete any existing compiled code like .jar, .war, … Use file explorer for this.

jarsWarsClean

Classes not found errors

  1. application.ModuleException: java.lang.ClassNotFoundException: oracle.adfinternal.view.faces.facelets.rich.IncludeHandler and oracle.adf.view.faces.bi.webapp.GraphServlet

If you are stuck with this exception and already done all recommended steps in Validate, Update and Add ADF projects missing dependencies, try to add a new empty page to your adfc-config.xml (you can remove it after). This will automatically add some libraries in the project properties. In my case it adds the “ADF DVT Core Runtime”, “Oracle BI Graph” and correct some others dependencies if it’s the case.

 

  1. application.ModuleException: java.lang.ClassNotFoundException: oracle.dss.rules.ComponentTypeConverter

This typically is associated with ADF projects that contain declarative components. I usually leave this one to solve in the end, because it is more complex to find the problem.

First thing I like to do is cleaning up the dependencies and add new ones that are used when we created a new declarative components ADF project. To guide you, try to remove the dependencies that aren’t in the following list and add the ones that your project is missing:

  1. In project->properties->Libraries and Classpath:declarativeComponents1
  2. In project->properties->JSP Tag Libraries:declarativeComponents2
  3. In project->properties->Facelets Tag Libraries:declarativeComponents3

If this doesn’t solve your problem, let’s try another approach. Before this, make a quick backup of your project so if anything goes wrong you can rollback and without losing your application.

First thing, close the declarative components ADF application from JDeveloper. You need to do this because you will change the .jpr ADF project file.

Search in your project for the tag “<hash>” followed by “<value n=”displayName” v=”WEB-INF/lib”/>”. In my declarative component, I solved the problem removing a lot of .jars that are referred here:

    1. Not working:
<hash>
     <value n="displayName" v="WEB-INF/lib"/>
     <hash n="filters">
        <list n="rules">
           <hash>
              <value n="pattern" v="xml-apis-ext.jar"/>
              <value n="type" v="1"/>
           </hash>
           <hash>
              <value n="pattern" v="prefuse.jar"/>
              <value n="type" v="1"/>
           </hash>
           <hash>
              <value n="pattern" v="dvt-utils.jar"/>
              <value n="type" v="1"/>
           </hash>
           <hash>
              <value n="pattern" v="dvt-shared-js.jar"/>
              <value n="type" v="1"/>
           </hash>
           <hash>
              <value n="pattern" v="dvt-facesbindings.jar"/>
              <value n="type" v="1"/>
           </hash>
           <hash>
              <value n="pattern" v="dvt-databindings.jar"/>
              <value n="type" v="1"/>
           </hash>
           <hash>
              <value n="pattern" v="dvt-basemaps.jar"/>
              <value n="type" v="1"/>
           </hash>
           <hash>
              <value n="pattern" v="batik-xml.jar"/>
              <value n="type" v="1"/>
           </hash>
          (…)
           <hash>
              <value n="pattern" v="jarUtilities.jar"/>
              <value n="type" v="1"/>
           </hash>
           <hash>
              <value n="pattern" v="com.bea.core.apache.commons.collections_1.0.0.0_3-2.jar"/>
              <value n="type" v="1"/>
           </hash>
           <hash>
              <value n="pattern" v="**"/>
              <value n="type" v="0"/>
           </hash>
        </list>
     </hash>
     <value n="internalName" v="libraries"/>
     <list n="selectedLibraries">
        <string v="ADF Faces Runtime 11"/>
        <string v="ADF DVT Faces Runtime"/>
     </list>
     <value n="targetWithinJar" v="WEB-INF/lib"/>
     <value n="type" v="3"/>
  </hash>
    1. Working:
<hash>
     <value n="displayName" v="WEB-INF/lib"/>
     <hash n="filters">
        <list n="rules">
           <hash>
              <value n="pattern" v="**"/>
              <value n="type" v="0"/>
           </hash>
        </list>
     </hash>
     <value n="internalName" v="libraries"/>
     <value n="targetWithinJar" v="WEB-INF/lib"/>
     <value n="type" v="3"/>
     <list n="unselectedLibraries">
        <string v="JarUtilities.jar"/>
        <string v="AdfLibResourceBundles.jar"/>
     </list>
 </hash>

Compile and Run

Now you can compile all ADF projects and deploy them to the WebLogic server. Don’t forget to see for each ADF project if the deploy ends successfully.

projectCompileStatus

 

Conclusion

Sometimes the ADF applications migration is not a simple button press, so when you are thinking of migrate our ADF application take in consideration that it is possible to lose some time to make all your code working in a new ADF version. However, I hope that reading this document could help you and speed up any problem situation you face in this process.

Keep checking out Red Mavericks for additional tips of Oracle Middleware technology

Cheers,
Pedro Curto

(this article is also published at Link Consulting’s website)

Post image by Steve Corey

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *