Installing a Java virtualization proxy into a Java application

You must enable the Java™ virtualization proxy to capture Java method calls being used by a Java application.

About this task

The greenhat.javaproxy.jar and registration.xml files in JavaProxy package with Rational® Test Control Panel must always be collocated. Otherwise, the Java virtualization proxy will not work correctly.

Procedure

  1. Add greenhat.javaproxy.jar to the CLASSPATH of the Java application.
  2. Change the Java application to use alternative settings for initial context factory and provider URL (if applicable).
    Note: If it is not possible to change the application's initial context factory or provider URL settings, you will not be able to use the Java virtualization proxy. As an alternative, you could use the Java virtualization agent.

IBM WebSphere Application Server 6.1

Review the following examples:
  • If the Java application that you are using connects with IBM® WebSphere® Application Server 6.1 using the thin client with provider URL iiop://localhost, you could intercept these calls by adding or modifying the following program arguments:
    -classpath greenhat.javaproxy.jar...
    -Djava.naming.factory.initial=com.ibm.rational.rit.javaproxy.jndi.ProxyInitialContextFactory
    -Djava.naming.provider.url=proxy:com.ibm.websphere.naming.WsnInitialContextFactory:iiop://localhost
    Note: The prefix proxy: and the final colon (:) before the original provider URL are required.
  • If the Java application that you are using connects with WebSphere Application Server 6.1 using the full J2EE client with provider URL iiop://localhost, you could intercept these calls by adding or modifying the following arguments in the launchClient tool:
    -CCclasspath=greenhat.javaproxy.jar
    -CCDjava.naming.factory.initial=com.ibm.rational.rit.javaproxy.jndi.ProxyInitialContextFactory
    -CCproviderURL=proxy:com.ibm.websphere.naming.WsnInitialContextFactory:iiop://localhost
    Note: The prefix proxy: and the final colon (:) before the original provider URL are required.
  • If using the full J2EE client, you must also do the following:
    • Create a classes folder in the installation folder of the application server client, for example, C:\Program Files\IBM\WebSphere\AppClient\classes.
    • Create a file named jndi.properties in the classes folder with following contents:
      com.ibm.ws.naming.java.realns.factory.initial=com.ibm.rational.rit.javaproxy.jndi.ProxyInitialContextFactory

Feedback