the hebrew scriptures ask the same question "Why do bad things happen to good people and Why do good things happen to bad people" basically thats it, and then Jesus comes along, does he answer that question ? does he help to become reconciled with God and have peace with God.
Think about Josiah and what a wonderful king he was his devotion to God and his righteousness his cleaning out the temple, the life he had with his brutal father Amon and then then after Mannasah repents brings Josiah up in Gods ways and after all that King Josiah gets murdered, why, the bible doesn't say. Then you have a completely different picture of King David, he commits adultry murderers, lies schemes, ext; his first born dies, those of his houshold suffer dreadfully because of what unfaithful David did, yet God sees fit to have Jesus come through his and bath-shebas lineage. David of course the bible says is repentant. Point is what about Josiah and what happened to him, why does God protect some and others he doesn't, this is a basic question that runs right through the hebrew scriptures, peace brother.