Considering the domestic and external conditions that Japan and China were facing in the 19th and early 20th century, what accounts for the contrast between the Japanese success in modernization and the failure by Qing China in the same historical period?

Considering the domestic and external conditions that Japan and China were facing in the 19th and early 20th century, what accounts for the contrast between the Japanese success in modernization and the failure by Qing China in the same historical period?