The difficulty of the cancer classification using multi-class microarray datasets lies in that there are only a few samples in each class. To effectively solve such a problem, we propose a hierarchical ensemble strategy, named as Hierarchical Ensemble of Error Correcting Output Codes (HE-ECOC). In this strategy, different feature subsets extracted from a dataset are used as inputs for three data-dependent ECOC algorithms, so as to produce different ECOC coding matrices. The mutual diversity degrees among these coding matrices are then calculated based on two schemes, named as the maximizing local diversity (MLD) and the maximizing global diversity (MGD) schemes. Both schemes can choose diverse coding matrices generated by the same or different ECOC algorithm(s), and the average fusion scheme is used to fuse the outputs of base learners. In the experiments, it is found that both MLD and MGD based HE-ECOC strategies work stably, and outperform individual single ECOC algorithms. In contrast with some ensemble systems, HE-ECOC generates a more robust ensemble system, and achieves better performance in most case. In short, HE-ECOC is a promising solution for the multi-class problem. The matlab code is available upon request.