Monday, May 18, 2009

OAF - Write Diagnostic statements for debug Purposes:

From your contorller :
import oracle.apps.fnd.framework.OAFwkConstants;

String testmsg = "This is a test diagnostic message";
pageContext.writeDiagnostics(this,"TESTDIAG: = " + testmsg ,OAFwkConstants.STATEMENT);

Then set profile option at user level
FND: Diagnostics - set to Yes
FND: Debug Log Enabled - set to Yes --default to NO
FND: Debug Log Level - set to Statement
FND: Debug Log Filename for Middle-Tier - give a path to a log file on the server. (test.log)
FND: Debug Log Level ---%

run the application and search for your diagnostic message in test.log file.

Thursday, May 14, 2009

Oracle Customer Online Extension

http://docs.google.com/Doc?id=dfpr7qkv_1534mpjxdd9

Thursday, May 7, 2009

OAF - Cant find server.xml ?

How to create server.xml if its not there in your $JAVA_TOP/...server/ folder
Many a times server.xml is not packaged with other objects in server folder for may packages. If you are lucky you may find it, but if you dont, then you will have to create it or ask oracle support to provide one.
I find the approach of recreating it much easier .

Approach1 : (Easy)
Create the business component package for java in Jdev mentioning the path till the server folder. It will create the server.xml file.
Now you have to add all your VO,EO and AM's in this package by selecting the package in jdev and click on the file menu > open button. Select all the files. Now all your VO,EO and AM's will be added to this server.xml
Pros: Simple and faster
Cons: leaves the VO/EO/AM in edit mode at users mercy to do something dumb and modify them.

Approach2 : (little hassle)
Take server.xml from some other folder from your /myprojects/..../server folder and add each and every entry for VO, VL, LOV, AM, EO manually. Agrred its a lot of pain , specially if you have to add 25 objects so
forexample : code from server.xml



Name="server"
SeparateXMLFiles="true"
PackageName="oracle.apps.imc.i.am.creating.this.server" >




Name="outthenameofAM"
FullName="oracle.apps.imc.i.am.creating.this.server.putthenameofAM"
ObjectType="AppModule" >

Name="putthenameofVO"
FullName="oracle.apps.imc.i.am.creating.this.server.putthenameofVO"
ObjectType="ViewObject" >



Now add this server.xml file to your project.jpr, you can see all the objects imported correctly
Pros: when you click on any VO, notice all the options are greyed out, so you cant accidentally modify them.
cons: its hard to manually edit the server.xml and add entries of each object.

But you know what , both approaches work and you can choose whatever works for you.

System.out.println in production code

This is the most commonly asked question in web applications development in jdeveloper including OA Framework, ADF, ejb, web services etc.
Can I leave System.out.println or System.err.println in the production code?
System.out.println comes handy when debugging the application because you can see the messages pretty much easily in the jdeveloper console. And it takes relatively less time than the debugging option in Jdeveloper. So even experienced developers use it for debugging. You may think, "Anyway this doesnot any affect in the production system". But actually System.out.println statements will have serious performance issue in the production system if you fail to remove them in the final code.

The reason is that the application server will have only one output stream and one error stream in the JVM. Hence multiple threads calling the System.out.println() have to be synchronized.

Considering the production system with thousands of users, back end programs, webservices, scheduled process running parralley in the machine. Calling system.out.println() will potentially block the performance of whole system.

Also the application server doesn't redirect the std out to a file, and is lost.

Hence always remove the System.out.println() /System.err.println() from the production code.

Ref : http://prasanna-adf.blogspot.com/2009/04/systemoutprintln.html

debug bc4j objects

How to debug the VO, LOV, poplist queries?

You can see the executed queries and its bind values in the jdeveloper console or messages window. By default, this option is not available in jdeveloper.
To enable the debug console option in Jdev 9i

1. Right click on project and select project properties

2. Navigate Configurations -> Development -> runner

3. Add the following parameter in the java options
-Djbo.debugoutput=console

4. Select OK

5. Rebuild the project and run again to see the debug information in jdeveloper log window

This option would be very helpful in finding out what going on in the bc4j objects. Including LOV queries, poplist queries, VOs etc. Whenever the query is executed through the AM or procedure is called, the bind variable values and executed sql will be displayed in the jdeveloper message window.