我正在编写Java Spring MVC应用程序。当我检查了网址(http://localhost:8080/ui/processes)时,它没有呈现视图,而是抛出这样的异常:
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
at java.security.AccessController.checkPermission(AccessController.java:884)
at org.eclipse.jetty.server.handler.ContextHandler$Context.getClassLoader(ContextHandler.java:2390)
at org.apache.jasper.compiler.TagPluginManager.init(TagPluginManager.java:73)
at org.apache.jasper.compiler.TagPluginManager.apply(TagPluginManager.java:57)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:241)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:374)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
我的web.xml:
<servlet>
<servlet-name>static</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>static</servlet-name>
<url-pattern>/ui/*</url-pattern>
</servlet-mapping>
static-servlet.xml:
<context:component-scan base-package="com.myproject.service.mypackage" />
<bean class =
"org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name = "prefix" value = "/jsp/" />
<property name = "suffix" value = ".jsp" />
</bean>
控制器:
@Controller
@RequestMapping("/processes")
public class ProcessesController {
@RequestMapping(method = RequestMethod.GET)
public ModelAndView printProcesses(){
ModelAndView model = new ModelAndView("Processes");
model.addObject("msg", "hello process");
return model;
}
}
Process.jsp是一个简单的html文件
<html>
<head>
<title> Process </title>
</head>
<body>
<h1> HAHAHAHA!!!! </h1>
</body>
</html>
我是Spring MVC的新手,所有步骤都遵循教程。任何人都知道是什么导致了上述异常以及如何解决它?