我有这个servlet:
@WebServlet("/admin/list_users")
public class ListUsersService extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
UserService userServices = new UserService();
List<Users> listUsers = userServices.listUser();
request.setAttribute("listUsers", listUsers);
String listPage = "user_list.jsp";
RequestDispatcher requestDispatcher = request.getRequestDispatcher(listPage);
requestDispatcher.forward(request, response);
}
}
在IntelliJ + GlassFish中执行userServices.listUser()
时,它将抛出:
javax.persistence.PersistenceException:java.lang.IllegalStateException:此Web容器尚未启动
相同的代码在Eclipse + Tomcat中可以完美地工作。
我的错误是什么?谢谢!