Striving for Optimal Performance
  • Home
  • Blog
    • Archive
    • Categories
  • Troubleshooting Oracle Performance
    • Description
    • Structure
    • Table of Contents
    • Forewords
    • Reviews
    • Downloadable Files
    • Addenda and Errata
  • Publications
  • Public Appearances
    • Past Public Appearances
  • Contact
  • Search
  • About

Posts in category Java

Debugging PL/SQL and Java Stored Procedures with JPDA

Oct18
2011
Leave a Comment Written by Christian Antognini

In 2003 I published a paper entitled Debugging PL/SQL and Java Stored Procedures with JPDA. Its aim was to describe how to debug PL/SQL and Java code deployed into the database with JDeveloper 9i. Two weeks ago a reader of my blog, Pradip Kumar Pathy, contacted me because he tried, without success, to do something similar with JDeveloper 11g, WebLogic 11g and Oracle Database 11g. Unfortunately I was not able to help him. The reason is quite simple, since 2004 I’m an Eclipse user…

Few days later Pradip contacted me again to let me know that, at last, he succeeded. Here you find his notes…

  1. Grant the required privileges
  2. GRANT DEBUG CONNECT SESSION to &&schema_name;
    GRANT DEBUG ANY PROCEDURE TO &&schema_name;

  3. Create a database connection under “Application Resources” and compile the stored procedure in debug modus (Figure 2a and Figure 2b)
  4. Write some Java code to let the database engine connect JDeveloper (this piece of code must be executed before calling the PL/SQL stored procedure)
  5. private static void remotePLSQLDebug(Connection con) throws SQLException
    {
      SystemProperties systemProperties = null;
      systemProperties = SystemProperties.getInstance();
      CallableStatement callState = null;
      String port = systemProperties.get("plsqldebug.port").trim();
      String storedCall = "call dbms_debug_jdwp.connect_tcp('localhost'," + port + ")";
      callState = con.prepareCall("{" + storedCall + "}");
      callState.execute();
      callState.close();
    }
  6. Configure the plsqldebug.port parameter in the application properties
  7. Edit the project properties to enable JPDA and defining the port used by the JPDA listener (Figure 5a and Figure 5b)
  8. Deploy the EAR in WebLogic and start the JPDA listener configured in the previous step
  9. Execute the Java code of step 3; as a result the database engine connects the JPDA listener and a connection process is created (Figure 7)
  10. When the PL/SQL stored procedure is executed, JDeveloper is able to debug it (open the PL/SQL stored procedure in the “Database Navigator” for that purpose)
  11. Once the debugging is over detach the connection process

Thank you Pradip to share your findings!

Posted in 11gR1, 11gR2

Oracle AD4J Installation on Linux

Feb13
2009
6 Comments Written by Christian Antognini

Today I tried to install Oracle AD4J on a Linux server that I have at home. The installation procedure is really simple and fully described here. Unfortunately, when I tried to access the console for the first time (that access is one of the installation steps), the HTTP server returned an internal server error (500). In the mod_jserv.log logfile I found the following error messages:

[13/02/2009 10:06:38:079] (EMERGENCY) ajp12: can not connect to host 127.0.0.1:3501
[13/02/2009 10:06:38:181] (EMERGENCY) ajp12: connection fail
[13/02/2009 10:06:38:181] (ERROR) an error returned handling request via protocol "ajpv12"

Mhmm… a listener should be available on port 3501. But, no such listener was available on my system (note that port 3500 is used for the HTTP listener):

oracle@helicon:/u00/app/oracle/product/ad4j/ [rdbms11107] netstat -l --numeric-ports | grep 350[01]
tcp        0      0 *:3500                      *:*                         LISTEN

A quick search in Metalink revealed that at least another person has hit the same issue few days ago (see bug# 8235076). Since OSS is still working on it, I’ll wait to see what the findings are. In the mean time, I was able to successfully install it on my Windows laptop.

Anyway, if somebody of you managed to successfully install AD4J on Linux, please, let me know!

ADDENDA (February 16th, 2009): Because of the comments of Charles and Michael I spent a bit more time looking at the problem. In fact, the first time I stopped immediately after seeing the bug in Metalink… I was lazy ;-) . Hey, I try to optimize my worktime as well. Anyway, both suggested to manually start jserv. When I tried to do so, I received an error (at last). Based on it the problem was self explanatory! The java environment was causing the problem… In fact, with the default installation of CentOS 4.4 only the package java-1.4.2-gcj-compat was installed. After downloading and installing the most recent version of HotSpot (build 1.6.0_12-b04) the problem was solved.

Posted in Bug, Oracle AD4J

PerformaSure X-Agent Configuration

Jan05
2009
3 Comments Written by Christian Antognini

PerformaSure of Quest Software is a J2EE performance diagnosis tool that provides an end-to-end transaction-centric view of performance as experienced by end users. To gather profile information PerformaSure uses one or several agents deployed on the monitored systems. Since gathering profile information depends on the monitored component, three different agents are available:

  • System agent gather performance figures about the operating system.
  • Web server agents gather performance figures about a web server.
  • Application server agents gather detailed performance figures about an application server.

Since the agents are specific to each component, Quest Software clearly states which components are officially supported. For example, the current release (4.4) supports the following application servers: BEA WebLogic Server, IBM WebSphere Application Server, Oracle Application Server, JBoss Application Server and Apache Tomcat Server. Even if those are among the most commonly used, other application servers exist… For this reason PerformaSure also supports a generic agent called X-Agent. Although the X-Agent does not provide as much information as the other agents do, it might be very useful in some situations. The problem is that the documentation does not provide instructions on how to configure the it. Instead, it provides the following information:

“The X-Agent needs to be configured by Quest Consulting. For more information about customizing the X-Agent and modifying the startup sequence of the application server or standalone Java application that you want to instrument, contact your Quest sales representative.”

Ups! Not very useful…

To show you how such a configuration is performed, let me describe what I did few days ago on my Windows XP laptop to configure the X-Agent for Sun Java System Application Server 9.1 Update 2.

  • First of all, I opened a command prompt and I defined two environment variables pointing to the installation directories of Java and PerformaSure
c:tmp>set JAVA_HOME=C:Javajdk1.5.0
c:tmp>set PERFORMASURE_HOME=C:JavaquestPerformaSure4.4.0
  • Then, in the same command prompt, I called the script preinstrumentor.cmd to create a JAR file that will be used during the startup of the application server
c:tmp>call "%PERFORMASURE_HOME%scriptspreinstrumentor.cmd" "%JAVA_HOME%"
2008-12-26 23:09:00.703 INFO  Loading Agent startup configuration from C:Java
  questPerformaSure4.4.0configagent.config
2008-12-26 23:09:02.031 INFO  PerformaSure 4.4 (Build PAS_440-20061024-1025) on
  Windows XP x86 5.1 using Sun Microsystems Inc. Java HotSpot(TM) Client VM
  version 1.5.0_10-b03 (extra info: mixed mode, sharing); Agent Type:
  Preinstrumentor
2008-12-26 23:09:02.062 INFO  Configured to connect to Nexus at localhost:41705
2008-12-26 23:09:02.187 INFO  Connected to Nexus at localhost:41705
2008-12-26 23:09:03.203 INFO  Agent started
2008-12-26 23:09:03.203 INFO  Creating bootstrap classes in C:JavaquestPerfo
  rmaSure4.4.0scripts..bootstrapC--Java-jdk-1.5.0.jar
2008-12-26 23:09:05.796 INFO  Preinstrumentation complete
2008-12-26 23:09:05.812 INFO  Preinstrumentor Agent shutdown completed
  • The last operation I performed through the command prompt was the “generation” of two Java options (-Xbootclasspath and -javaagent) to be used in the configuration of the application server (it is not necessary to do it in this way, but with that method it’s possible to avoid annoying typos…)
C:Tmp>call "%PERFORMASURE_HOME%scriptsmakebootstrappath.cmd" "%JAVA_HOME%"
C:Tmp>echo -Xbootclasspath/p:"%PS_BOOTSTRAP_PATH%"
-Xbootclasspath/p:"C:JavaquestPerformaSure4.4.0bootstrapC--Java-jdk-1.5.0.jar"
C:Tmp>echo -javaagent:"%PERFORMASURE_HOME%libperformasure-agent.jar"
-javaagent:"C:JavaquestPerformaSure4.4.0libperformasure-agent.jar"
  • To finish the configuration I added, through the administration console of the application server, the following JVM options (click here to see an image of the relevant part of the console)
-Dperformasure.agent.appserverinfo=kalgan:Generic:SunAS9
-Dperformasure.debug=0
-Xbootclasspath/p:"C:JavaquestPerformaSure4.4.0bootstrapC--Java-jdk-1.5.0.jar"
-javaagent:"C:JavaquestPerformaSure4.4.0libperformasure-agent.jar"

Notice that the value of the variable performasure.agent.appserverinfo has the following format: <server>:Generic:<version>.

After these operations I restarted the application server and, as a result, I was able to use PerformaSure to profile the applications running into the JVM of the application server.

Posted in Quest PerformaSure

EvoLve theme by Theme4Press  •  Powered by WordPress Striving for Optimal Performance