Why was the Union army defeated at Chancellorsville?

Why was the Union army defeated at Chancellorsville?