Java Dynamic Management Kit 5.0 Tutorial

Running the Example With Authentication

The examplesDir/Context directory contains the applications that demonstrate the use of password authentication through the HTTP connector.

To Run the Example With Authentification
  1. Compile all files in this directory with the javac command.

    For example, on the Solaris platform with the Korn shell, type:


    $ cd examplesDir/Context/
    $ javac -classpath classpath *.java
    
  2. Start the agent in a terminal window and specify a list of login-password pairs, as in the following command:


    $ java -classpath classpath ContextAgent  jack jill  billy bob
    
  3. Wait for the agent to be completely initialized, then start the manager in another window with the following command:


    $ java -classpath classpath ContextClient -ident andy bob
    

    The client application tries to establish a connection with the login andy and the password bob. The authentication mechanism refuses the connection, and the com.sun.jdmk.comm.UnauthorizedSecurityException is raised by the connector server.

  4. Start the manager again, this time with a valid identity:


    $ java -classpath classpath ContextClient -ident jack jill
    

    The connection is established and the output from management operation is displayed in both windows.

  5. Leave both applications running for the next example.