The sevlet code giving Exception 'java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "createClassLoader")'
Code:
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String name=req.getParameter("name");
String email=req.getParameter("email");
int marks=Integer.parseInt(req.getParameter("marks"));
Student st=new Student(0,name,email,marks);
System.out.println("Inside get method before configuration object generation");
Configuration cfg=new Configuration();
System.out.println("After configuration initialization");
cfg.configure("Resourses/hibernate.cfg.xml");
System.out.println("after giving hibernate config file");
sf=cfg.buildSessionFactory();
}
I am getting this error
Code:
Sep 25, 2016 8:56:41 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Controller.StudentRegistrationServlet] in context with path [/StudentRegistration] threw exception
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "createClassLoader")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
Creation of Configuration object inside servlet giving me this exception. Pls help.