Anaerobic treatment of lignocellulosic material for energy generation