wordpress plugin is not activating from widget

The second parameter for add_action() must be a function or a member of an object. In the second case you have to pass an array ( $object, 'method_name').

To register the widget from within the class, add the following method to your widget class:

/**
 * Tell WP we want to use this widget.
 *
 * @wp-hook widgets_init
 * @return void
 */
public static function register()
{
    register_widget( __CLASS__ );
}

Then change your add_action() call to:

add_action( 'widgets_init', array ( 'wp_my_plugin', 'register' ) );