ないわけにはいかない・ざるを得ない・ねばならない: the difference
Meaning
Can't not, No way to avoid
Past papers
Tested once in past papers
Example
訳あって、白髪を染めないわけにはいかないんです。
For certain reasons, I can't leave my gray hair undyed.
ざるを得ないN2
Meaning
Can't help doing, Have no choice but
Past papers
Tested 3 times in past papers
Example
サプライズのプレゼントに、驚かざるを得なかった。
I couldn't help but be surprised at the surprise present.
ねばならないN2
Meaning
Must, Have to, Should
Past papers
Example
家賃を月末までに払わねばならない。
I have to pay rent by the end of the month.
How to tell them apart
「ないわけにはいかない」: bound by social ties, morals or face; it would be wrong not to.
「ざるを得ない」: circumstances leave no other choice, so you do it against your will; written.
「ねばならない」: a formal written 'must'; duty and rules.
「なければならない」: the everyday, objective 'must'.