We study the mass spectra of excited baryons with the use of the lattice QCD simulations. We focus our attention on the problem of the level ordering between the positive-parity excited state N(1440) (the Roper resonance) and the negative-parity excited state N^*(1535). Nearly perfect parity projection is accomplished by combining the quark propagators with periodic and anti-periodic boundary conditions in the temporal direction. Then we extract the spectral functions from the lattice data by utilizing the maximum entropy method. We observe that the masses of the N and N^* states are close for wide range of the quark masses (M_pi=0.61-1.22 GeV), which is in contrast to the phenomenological prediction of the quark models. The role of the Wilson doublers in the baryonic spectral functions is also studied.