Existing research on unsupervised domain adaptation (UDA) has primarily centered on mitigating differences in feature distribution across various domains. However, in real-world scenarios, natural data often exhibits not only a disparity in instance counts across different classes within the same domain but also across different domains, leading to imbalances at both the class and domain levels. To address this issue, this study introduces a novel scenario, termed extreme imbalance domain adaptation (EIDA), which encompasses both covariate shifts and labeling shifts. We propose a Domain Adaptation with Class-aware (DACA) framework for bearing fault diagnosis that aims to tackle inter-domain feature shifts as well as intra- and inter-domain category imbalances. Specifically, DACA enhances the recognition accuracy of minority categories without degrading the performance concerning the majority category, reduces the adverse effects of data imbalance during domain transitions, and strengthens the robustness of decision boundaries for improved spatial matching. This is achieved through four sub-modules: adversarial clustering learning, cross-domain category alignment, category-level reweighting, and category-level re-margining. The efficacy of DACA is demonstrated through simulations of three imbalance protocols in the EIDA scenario across two bearing datasets and one gearbox dataset, showcasing significant advancements in cross-domain diagnostic tasks.