29 March, 2013

Start Weblogic without user and password

When you want to launch your weblogic server at production, you need to use the startWeblogic.sh in your bin folder.

But each time it's launched it's asking you to authenticate yourself by typing a user and password. It's a problem when you want to automate the execution of your server...

To avoid this problem all you need to do is creating a file named "boot.properties" and insert into the two following lines :

username=<yourUserName>
password=<yourPassword>
this file must be placed in each server security folder : $WLS_HOME/user_projects/domains/<domainName/servers/<serverName>/security

Then, start server, it shouldn't ask you for anythin, then reopen your boot.properties file, password and username should be automatically encrypted !
Thanks

25 March, 2013

Avoid java out of memory with Weblogic

This is common exception always exists if you install weblogic and doesn't extend memory arguments in server.

The file "setDomainEnv.sh" in $WLS_HOME/user_projects/domains/<domainName>/bin/ has configuration of domain.

If you edit this file it will have the following default values.
MEM_ARGS="-Xms256m -Xmx512m"
export MEM_ARGS
MEM_PERM_SIZE="-XX:PermSize=48m"
export MEM_PERM_SIZE
MEM_MAX_PERM_SIZE="-XX:MaxPermSize=128m"
export MEM_MAX_PERM_SIZE

you should modify the MEM_ARGS java memory value depending of your server, here is the suggested to increase.
MEM_ARGS="-Xms2024m -Xmx3036m"
export MEM_ARGS
MEM_PERM_SIZE="-XX:PermSize=128m"
export MEM_PERM_SIZE
MEM_MAX_PERM_SIZE="-XX:MaxPermSize=512m"
export MEM_MAX_PERM_SIZE


Note : choosing the values depend on you server hardware.

Thanks

19 March, 2013

Oracle OAF Profile Option

Oracle OAF has some important profile options which is useful in extension or personalization.
I will list it below and write breif about every profile option.

1- FND_Diagnostics
Setting this profile option to YES, will add anew link "Diagnostics" at top right on page, that allow developer to trace logs.

To add log when coding use the following code in Controller or Application Module
In Controller write this code:-
pageContext.writeDiagnostics(this, "Phrase will be added to logs", 1);

In Application Module write this code
getOADBTransaction().writeDiagnostics(this, "Phrase will be added to logs", 1);

2- Personalize Self-Service Defn
 Set this profile to Yes to allow personalization. 

3- FND: Personalization Region Link Enabled :
Set this profile to  Yes  show "Personalize  Region" links above each  region in a page.


4- Disable Self-Service Personalization
Yes will disable all personalization at any level.

5- FND: Personalization Document Root Path
Set this profile option to a directory at application server machine which will contain import/export personalization files.

Thanks

08 March, 2013

Redirect to ParentAction Programatically

In your task flow you can redirect parent action programatically using the following method.
   
public void redirectToParentAction(String parentAction) {
        ControllerContext ctrlCtx = ControllerContext.getInstance();
        ViewPortContextImpl portImpl = (ViewPortContextImpl)ctrlCtx.getCurrentViewPort();
        ParentActionEvent parentEvent = new ParentActionEvent(parentAction, true);
        portImpl.queueParentActionEvent(parentEvent);
    }



Thanks

04 March, 2013

Generate View URL in ADF

The following  getUrl method generates URL for you view in ADF application.
You pass servlet name and view id, I also overloaded getUrl method for making default servlet name as "faces".

   public static FacesContext getFacesContext() {  
     return FacesContext.getCurrentInstance();  
   }  
   
   public static ExternalContext getExternalContext() {  
     return getFacesContext().getExternalContext();  
   }  
   
   
   public static String getURL(String servletName, String viewId) {  
     HttpServletRequest request = (HttpServletRequest)getExternalContext().getRequest();  
   
     String requestUrl = request.getRequestURL().toString();  
   
     StringBuilder newUrl = new StringBuilder();  
   
     newUrl.append(requestUrl.substring(0, requestUrl.lastIndexOf(servletName)));  
   
     newUrl.append(servletName);  
   
     newUrl.append(viewId.startsWith("/") ? viewId : "/" + viewId);  
   
     return newUrl.toString();  
   }  
   
   public static String getURL(String viewId) {  
     return getURL("faces", viewId);  
   }  

Import the following Classes

 import javax.faces.context.ExternalContext;  
 import javax.faces.context.FacesContext;  
   
 import javax.servlet.http.HttpServletRequest;  

Thanks