401K Withdrawal - Double Taxation in MA / NJ State

I did early withdrawal from a 401K pre-tax account. I contributed to 401K when I was working in MA and now I live in NJ as a NJ resident.

 

I realized that in MA - you need to pay for the money that's sourced from MA even though you are no longer a resident. But NJ also tax on all incomes. In this situation it seems I will be double taxed from both MA and NJ.

I wonder how can I avoid this situation. I know for ordinary W2 income you can claim credit back if you are taxed by another state while you are a resident of NJ. I wonder can we do that with 401K money?

 

Thanks for help in advance!