javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletCont

 

java.lang.NoSuchMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
	at org.apache.jsp.WEB_002dINF.views.login_jsp._jspInit(login_jsp.java:22)
	at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
	at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

 

 

  1、在使用Maven项目中,我们用到HttpServletRequest,HttpServletReponse时,会自然想到引用

       中servlet-api.jar和jsp-api.jar,同时为为避免发布时tomcat/lib下这两个jar产生冲突,因把jar作用域设置为provided;

     

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>
		
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.0</version>
			<scope>provided</scope>
		</dependency>

 

 

   启动时没有问题,但是访问时出现了以上的异常,我看好像是jsp编译的时候出问题了,于是将jsp-api的配置部分删除,保留servlet-pai的配置;

                <dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>

  

 

问题解决,具体原因没搞清楚,先暂时这么记录下,到时再好好研究下。

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletCont)