Tuesday, December 22, 2009

FAQ #5 - How to remote profile an ADF application deployed on standalone WebLogic using JDeveloper 11g R1

Introduction

Profiling is a valuable tool in the JDeveloper toolbox that can help us in the diagnosis of performance issues by identifying code that consumes more time, code that is called more often (CPU profiling) and how memory is used by the deployed application (memory profiling).

Main Theme

To demonstrate this FAQ, let's create a sample Fusion Web Application (Web) based on the HR schema. Let's create an Employee entity from the EMPLOYEES table and an Employees view based on the Employee entity. Finally, let's bundle the Employees view in the HrAppModule application module.

For the ViewController let’s create a View Activity called Employees directly in the unbounded adfc-config task flow and an Employees.jspx JSF page for the Employees View Activity. Finally, let’s drag the Employees view from the HrAppModuleDataControl in the Data Controls and drop it onto the Employees.jspx JSF page as an ADF Form.

Configure the application security and deploy onto the standalone WebLogic server as explained in FAQ #3 - How to deploy an ADF application on a standalone WebLogic server directly from JDeveloper.

If you have any issues related to security or connecting to the database when running the deployed application, take a look at the references section at the bottom for a couple of pointers.

Once the application is deployed, let’s verify that all is well by accessing the application URL in your browser. For the sample application attached, enter the URL http://localhost:7001/JDeveloperFAQNo5/faces/Employees. You should see the log in screen below.
   

 
Log in using jdeveloper/jdeveloper1. The Employees page below will be displayed.
 

 
OK, let’s do some profiling now!

To enable remote profiling, bring up the Project Properties dialog and select Run/Debug/Profile. Select the Default run configuration from the list of Run Configurations and click Edit….



In the Profiler page under Tool Settings enter the name of the package in our code based on which the profiler results will be filtered. For the sake of our sample application enter com.jdeveloper.faq.*. This will enable the profiling of all the java classes that we generated in the ADF BC.



Click OK a couple of times to exit from the Project Settings dialog and then save the project settings.

From the Run menu select Attach to | CPU Profilee.



In the Attach to CPU Profilee dialog select Attach to Local Process, select the weblogic.Server process and click OK.



Once attached, the Profiling ViewController tab will be displayed. Click on the Begin Use Case to begin a new profiling use case. That is, the icon on the top left with the green run triangle.



In order to generate profiling metrics, play around with the sample application deployed on WebLogic. As you can see CPU statistics are generated. The Hotspots tab displays the methods in the code where most CPU is spent in terms of percentage of CPU time. The Call Stacks tab displays the metrics in a different view.



There are all sorts of other goodies you can do while profiling. For example, saving a use case and then comparing it with the new one that you run after you make certain code changes could be useful to verify the changes in performance.

Conclusion

Profiling an application is another tool that could be of use when looking for bottlenecks and performance improvements in your application. It’s easy to setup and use. Give it a try!

Until the next time, keep on JDeveloping!

References

http://andrejusb.blogspot.com/2009/12/solving-error-403-forbidden-in-adf.html
http://radalcove.com/blog/?p=34 [at the bottom of the page]

Code

http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo5.rar










6 comments:

  1. Hi Nick,

    I followed your procedure but when I login into employees.jspx after authorization, I get a blank page with only outputtext at top. (security role in weblogic.xml is correct)

    Screen shot:
    http://img717.imageshack.us/img717/6817/23660110.jpg

    Anticipating your reply
    Regards-

    ReplyDelete
  2. Forgot to mention its displaying the data when I deploy it through the integrated server.

    ReplyDelete
  3. Hi Senthil,

    Can't tell you off hand what the problem might be. A couple of basics to try: 1) Ensure that the database connection is OK, 2) Ensure that WLS is setup for remote profiling. Are there any exceptions in the log?

    ReplyDelete
  4. Hi,

    You are profiling a local process, not a remote one (another machine)... this is not "remote profile" as the title says...

    ReplyDelete
  5. Can someone point out the instructions for remote profiling

    ReplyDelete
  6. I have an error 403 and need help..

    I have a server with Oracle Linux 6.3.

    I wrote this article about install & configure WebLogic Server to run ADF 11g Applications:

    http://www.oracle.com/webfolder/technetwork/jdeveloper/howto/11114/managedserver/wlsadfms.html

    Everything is ok.


    After that, on my desktop I created very simple ADF application (just some columns from table HR.EMPLOYEES) on JDeveloper 11.1.1.7.0:

    http://infotechinspiration.blogspot.ru/2011/08/in-this-post-i-will-show-you-how-to.html




    This ADF successfully deployed and started when I using integrated WebLogic server in JDeveloper.

    After that I successfully deployed this ADF on standalone WebLogic Server:

    [11:04:06 AM] ---- Deployment started. ----
    [11:04:06 AM] Target platform is (Weblogic 10.3).
    [11:04:11 AM] Retrieving existing application information
    [11:04:12 AM] Running dependency analysis...
    [11:04:12 AM] Building...
    [11:04:14 AM] Deploying 2 profiles...
    [11:04:14 AM] Wrote Web Application Module to C:\JDeveloper\mywork\MyFirsADFpp\ViewController\deploy\MyFirsADFpp_ViewController_webapp1.war
    [11:04:14 AM] Wrote Enterprise Application Module to C:\JDeveloper\mywork\MyFirsADFpp\deploy\MyFirsADFpp_application1.ear
    [11:04:14 AM] Deploying Application...
    [11:04:16 AM] [Deployer:149191]Operation 'deploy' on application 'MyFirsADFpp_application1' is initializing on 'ADFServer'
    [11:04:21 AM] [Deployer:149192]Operation 'deploy' on application 'MyFirsADFpp_application1' is in progress on 'ADFServer'
    [11:04:29 AM] [Deployer:149194]Operation 'deploy' on application 'MyFirsADFpp_application1' has succeeded on 'ADFServer'
    [11:04:29 AM] Application Deployed Successfully.
    [11:04:29 AM] The following URL context root(s) were defined and can be used as a starting point to test your application:
    [11:04:29 AM] http://10.10.10.111:7003/MyFirsADFpp-ViewController-context-root
    [11:04:29 AM] Elapsed time for deployment: 23 seconds
    [11:04:29 AM] ---- Deployment finished. ----

    I haven't any security configuration..


    So, when I try to link(http://10.10.10.111:7003/MyFirsADFpp-ViewController-context-root
    ) I’ve received an error 403:

    Error 403--Forbidden

    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:

    10.4.4 403 Forbidden

    The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.



    I suppose, this error arise from ADF Securiy. But I really don’t know and understand a reason and how to solve this problem…

    You are an expert in ADF and could you please help me? It would be great!

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...