Saturday, November 3, 2018

Logout and expiring session in Oracle ADF

To end a user's session before the session expires, you can call the invalidate() method on the HttpSession object from a backing bean in response to the user's click on a Logout button or link. This cleans up the HttpSession in the same way as if the session time had expired. Using JSF and ADF, after invalidating the session, you must perform a redirect to the next page you want to display, rather than just doing a forward.

Following code shows a way to perform this task from a Logout button.           

 import javax.faces.context.ExternalContext; 
 import javax.faces.context.FacesContext; 
 import javax.servlet.http.HttpServletRequest; 
 import javax.servlet.http.HttpSession;                
 import weblogic.servlet.security.ServletAuthentication; 
  
   public String onLogout(){ 
     FacesContext fctx = FacesContext.getCurrentInstance(); 
     ExternalContext ectx = fctx.getExternalContext(); 
     String url = ectx.getRequestContextPath() + "/adfAuthentication?logout=true&end_url=/faces/login.jspx"; 
      
     HttpSession session = (HttpSession)ectx.getSession(false); 
     session.invalidate(); 
      
     HttpServletRequest request = (HttpServletRequest)ectx.getRequest(); 
     ServletAuthentication.logout(request); 
     ServletAuthentication.invalidateAll(request); 
     ServletAuthentication.killCookie(request); 
      
     try{ 
       ectx.redirect(url); 
     } 
     catch(Exception e){ 
       e.printStackTrace(); 
     } 
     fctx.responseComplete(); 
      
     return null; 
   } 

Happy learningJ

Thursday, October 11, 2018

Oracle ADF Application – Migration from 12.2.1.0.0 to 12.2.1.3.0

                        Sometimes the ADF applications migration is not a simple button press, so when you are thinking of migrating 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.

Ideally, When we thought of migration, we will just install the required version and open old version ADF application new version JDeveloper. 

So, it will show the migration wizard, Whereas it's given while we are doing  Migration from 12.2.1.0.0 to 12.2.1.3.0.

Here are the simple steps I followed to migrate the ADF application from 12.2.1.0.0 to 12.2.1.3.0.

I made below changes on jws and jpr files to migrate. [ Close the application from Jdeveloper]

1. jws changes: comment the below line in Application jws.

  <!--<value n="oracle.mds.internal.dt.ide.migrator.MDSConfigMigratorHelper" v="11.1.1.0.5313"/>-->

2. jpr changes: comment the below line in project jpr.

<!--<value n="oracle.adfdtinternal.view.common.migration.wizards.MigrationHelper" v="11.1.1.1.0.3"/>-->

 Note:-  need to do the same for all jpr's if you have multiple projects in the application.

Open the Application in JDeveloper(after changes)- now it will ask for migration wizard.






How? Can I verify the migration? Probably (Thinking………..? running the application and see if its working as expected) J

I can also check by verifying the below changes in jpr and jws.

Jpr:- Check the below values

Before migration:
<value n="oracle.ide.model.Project" v="12.2.1.0.0"/>

After Migration:
<value n="oracle.ide.model.Project" v="12.2.1.0.0;12.2.1.3.0"/>

And commented one will change back while migration.
                <value n="oracle.adfdtinternal.view.common.migration.wizards.MigrationHelper" v="11.1.1.1.0.3"/>

Jws:- Check the below values

Before migration:
<value n="oracle.ide.model.Project" v="11.1.1.1.0;12.2.1.0.0"/>

After Migration:
<value n="oracle.ide.model.Project" v="11.1.1.1.0;12.2.1.0.0;12.2.1.3.0"/>

And commented one will change back while migration.
<value n="oracle.mds.internal.dt.ide.migrator.MDSConfigMigratorHelper" v="11.1.1.0.5313"/>

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.

Happy learning…. J

Thursday, October 4, 2018

Oracle.ons.NoServersAvailable: Subscription Time Out || workaround and Patch

                      Recently after  Upgrading Fusion Middleware from 12.2.1.0 to 12.2.1.3, while I try to connect data source with the 12c database. 

I see one issue saying that  Oracle.ons.NoServersAvailable: Subscription Time Out.

After some research, I found that we need to add one parameter in setDomainEnv.cmd or sh.

It turns out this is a bug in the JDBC driver bundled with WebLogic 12.2.1.3.0 and there is a simple workaround for it:


set the parameter -Doracle.jdbc.fanEnabled=false to JAVA_OPTIONS in setDomainEnv.sh file and restart all the servers in the domain

Or for the permanent fix, you can install patch provide by Oracle Patch 26045997

Happy Learning...😊