Monday, October 31, 2011

ADF : Clean your drs , mds folder using Script

In day to day ADF development we run in to various issue and one of the issue is sometime taskflow fragment do no show latest changes  when you run the application from jdeveloper. so you stop the embedded  weblogic server in Jdeveloper and delete the deployed application folder from DRS and MDS directory in jdeveloper.

Locate weblogic by looking in to jdeveloper running integrated weblogic.

image

Based on above path , my drs  and o.mds.dt is located in below folder path.

C:\Users\hasim\AppData\Roaming\JDeveloper\system11.1.1.4.37.59.23\o.j2ee\drs

C:\Users\hasim\AppData\Roaming\JDeveloper\system11.1.1.4.37.59.23\o.mds.dt\adrs

Delete specific project or all project based on your need from above folder and run your application again and you can see your latest changes in taskflow , so issue is resolved.

Write Script to perform cleaning job

You will face this issue regularly , so why don’t you write script that will perform the above deletion.

1. open your notepad and copy paste below content.

ECHO OFF
CD YOUR_DRS_DIRECTORY
rd. /S /Q .
CD YOUR_MDS_DIRECTORY
rd. /S /Q .
ECHO "All Project deleted from drs,mds folder"


Replace YOUR_DRS_DIRECTORY and YOUR_MDS_DIRECTORY with your corresponding directory and try this script with only /S option that will actually prompt you before deletion.



2.Save this file as “MyJdevClean.bat” and run this script whenever you want to clean your drs,mds folder.



Integrate script to Jdeveloper How about integrating this script to jdeveloper,so you can run from there instead of any drive . Go to below menu and click yes.



image



You will get this dialog



image



Click new and give the path of your bat file. after you are finished , you will see the bat file in your jdeveloper.



image





You can follow same approach to create your own little world toolbar for your day to day need.

Saturday, October 29, 2011

ADF : Create Help Library using javadoc

For every software application creating help document for all functions and methods is most important thing for future reference.

Fortunately and very thanks to Oracle ADF Framework development team for providing help comment by default in Oracle ADF BC Impl files.

Here is following example of  EntityImpl.java files.

Normal Comment

Normal comment in java begin with /* and ends with */ and every thing between this two is ignored by compiler.

Javadoc

A javadoc comment begin with /** and end’s with */ and every thing between this two is ignored by compiler.Please create simple ADF BC project and generate Java files for EO , VO object.

To generate documentation we just have to run following command.

javadoc DepartmentsImpl.java

It will generate Help file just like Java Documentation online.

image

Monday, October 17, 2011

Weblogic : WLST CMO object (Current Management Object)

 

In previous blog if you have noticed that I have used cmo.setConsoleEnabled(true) in WLST offline mode.

What is cmo ?

cmo is WLST inbuilt variable which stands for Current Management Object. We can use cmo to point to current MBean instance. cmo value changes when we navigate to different hierarchy of MBeans under Weblogic MBean Tree except JNDI Tree.

Once we are connected to WLST , we can use cmo for various operation like get , set , invoke on management object.

Example :-

wls:/mydomain/edit> cmo.setAdministrationPort(7001)

This variable is available in all hierarchy except custom and jndi.

CMO value is current WLST Path. Each time we change directory WLST change path.

image

Sunday, October 16, 2011

Weblogic : Disable Console and Enable it using WLST

In Big Companies where there are 100’s of weblogic instance ,it is not best practice to use Console to do weblogic administration.  However , it is WLST that is used to do day to day weblogic administration task.

So first let us disabled the console ,so it can’t be accessed.

Click the domain to go to following tab;

image

In Advanced section uncheck this box.

image

After restarting weblogic server you will not be able to access http://localhost:7001/console it will throw 404 Not Found Error.

Now let us say if you want to set this flag again then we must use WLST to set this flag again.

Go to WL_HOME\common\bin\wlst.cmd ( Weblogic Scripting Tool)

run the following command

//Connect to weblogic admin server
connect('weblogic','welcome1') 
//mark it for edit
edit()
//start the edit
startEdit()
//set the flag to true
cmo.setConsoleEnabled(true)
//save the changes
save()
//activate the changes
activate()


Please restart the server.



Now try to access the console and you will be able to access it.

Thursday, October 6, 2011

Weblogic : Lock your Weblogic Configuration using Change Center

 

If you are sharing same development weblogic instance with multiple developer then it is best in interest of team to use locking feature provided by weblogic server Change Center, so only one developer can make changes at a time to weblogic configuration.

If you login to weblogic console you will see following Change Center above Domain Structure of your weblogic.

image

Change Center not Visible

If it is not visible then please to go

Home > Domain_Name > Preferences

image

Click User Preferences

Uncheck – Automatically Acquire Lock and Activate Changes

Note:- This feature is not available in Production Mode to disable Change Center.

image

If unchecking this option you will see Change Center with multiple button.

Lock & Edit

If you decide to do some operation on console like create Data Source etc. then first click Lock & Edit and make the changes and then click button below Lock & Edit which will be usually “Activate Changes” or “Release Configuration”

Apply Changes

After you click button to apply the changes then configuration changes are distributed to each of the servers. if changes are accepted by each servers , then they take effect. if any server cannot accept change ,then all changes are rollback from all the server in domain.

The  changes are left in pending state; you can then either edit pending changes to resolved issue or revert previous configuration.

You can explore other options available in Preferences.