Servlet.service() for servlet [jsp] 抛出异常

Servlet.service() for servlet [jsp] threw exception

pom.xml

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

<dependency>
    <groupId>javax.servlet.jsp.jstl</groupId>
    <artifactId>javax.servlet.jsp.jstl-api</artifactId>
    <version>1.2.1</version>
</dependency>

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

https://github.com/mansreeal/StanWeb/blob/main/pom.xml

login.jsp

<% tablib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<title>login</title>
</head>

<script src="${pageContext.request.contextPath}/js/scripts/jquery.min.js"></script>
</html>

项目结构

Folder structure
+StanWeb
 +Java Resources
 +src/main/java
 +src/main/resources
 +config
 +Libraries
 +JavaScript Resources
 +Referenced Libraries
 +Deployed Resources
 +src
  +main
   +java
   +resources
   +webapp
    +META-INF
    +views
    +resources
    +WEB-INF
     +lib
     -dispatcher-servlet.xml
     -spring-security.xml
     -web.xml
pom.xml 

错误详情

org.apache.catalina.core.ApplicationDispatcher invoke 
SEVERE: Servlet.service() for servlet [jsp] threw exception
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at javax.el.CompositeElResolver.add(CompositeELResolver.java:47) 
at org.apache.jasper.el.JasperELResolver.add(JasperELResolver.java:79)
at org.apache.jasper.el.JasperELResolver.<init>(JasperELResolver.java:64) 
at org.apache.jasper.runtime.JspApplicationContextImpl.createELResolver(JspApplicationContext Impl.java:116)
at org.apache.jasper.runtime.JspApplicationContextImpl.createELContext(JspApplicationContext Impl.java:90)
at org.apache.jasper.runtime.PageContextImpl.getELContext(PageContextImpl.java:705)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:690) 
at org.apache.jsp.pages.headerlogin_jsp._jspService(headerlogin.jsp.java:139)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.jasper.servlet.JspServletWrapper.service(spServletWrapper.java:467)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:378) 
at org.apache.jasper.servlet.JspServlet.service(spServlet.java:326)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:710)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:578) 
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:514)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimelibrary.java:954)
at org.apache.jsp.pages.login.login_jsp._jspService(login_jsp.java:125) 
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) 
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:467)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:378) 
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:326)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:710)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384) 
at org.apache.catalina.core.ApplicationDispatcher.forward(Application Dispatcher.java:312)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:170)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:314)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1325)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1069)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1008)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
at org.springframework.web.servlet.FrameworkServlet.service(Framework Servlet.java:855)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
at com.StanWeb.ui.filter.ApplicationFilter.doFilter(ApplicationFilter.java.237)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 
at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePer RequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66) 
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:155) 
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) 
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) 
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) 
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) 
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) 
at org.apache..http11.Http11Processor.service(Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) 
at org.apache.coyote.AbstractProtocols$ConnectionHandler.process(AbstractProtocol.java:887) 
at org.apache.tomcat.util.net.NioEndpoint SocketProcessor.doRun(NioEndpoint.java:1684)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runworker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor $Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThreadSWrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

org.apache.catalina.core.StandardWrapperValue invoke 
SEVERE: Servlet.servce() for servlet [dispatcher] in context with path [/StanWeb] threw exception [An exception occured processing [views/login.jsp] at line [6]
<script src="${pageContext.request.contextPath}/js/scripts/jquery.min.js"></script>

org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory [C:\Program Files\apache-tomcat-9.0.48\webapps\docs]
org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARS that were scanned but no TLDs were found in them. Skipping unneeded JARS during scanning can improve startup time and JSP compilation time.
org.apache.catalina.core.ApplicationContext log 
INFO: No Spring WebApplicationInitializer types detected on classpath
org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\Program Files\apache-tomcat-9.0.48\webapps\docs]has finished in [3,185] ms 
org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [C:\Program Files\apache-tomcat-9.0.48\webapps\examples] 
org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARS that were scanned but no TLDs were found in them. Skipping unneeded JARS during scanning can improve startup time and JSP compilation time.
org.apache.catalina.core.ApplicationContext log 
INFO: No Spring WebApplication Initializer types detected on classpath
org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: context Initialized()
org.apache.catalina.core.ApplicationContext log 
INFO: SessionListener: contextInitialized()
org.apache.catalina.core.ApplicationContext log 
INFO: ContextListener: attributeAdded("StockTicker', 'async.Stockticker@55cee89')
org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deployment of web application directory [C:\Program Files\apache-tomcat-9.0.48\webapps\examples] has finished in [3,274] ms
org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory [C:\Program Files\apache-tomcat-9.0.48)webapps\host-manager] 
org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARS during scanning can improve startup time and JSP compilation time.
org.apache.catalina.core.ApplicationContext log 
INFO: No Spring WebApplicationInitializer types detected on classpath
org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\Program Files\apache-tomcat-9.0.48\webapps host-manager] has finished in [2,555] ms 
org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory [C:\Program Files\apache-tomcat-9.0.48\webapps\manager]
org.apache.Jasper.servlet.TldScanner scanJars 
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARS during scanning can improve startup time and JSP compilation time.
org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath 
org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\Program Files\apache-tomcat-9.0.48\webapps\manager] has finished in [2,841] ms
org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory [C:\Program Files\apache-tomcat-9.0.48\webapps\ROOT]
org.apache. jasper.servlet.TldScanner scanJars 
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARS that were scanned but no TLDs were found in them. Skipping unneeded JARS during scanning can improve startup time and JSP compilation time. 
org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplication Initializer types detected on classpath 
org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [C:\Program Files\apache-tomcat-9.0.48\webapps\ROOT] has finished in [2,104] ms
org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-9090"]
org.apache.catalina.startup.Catalina start
INFO: Server startup in [86855] milliseconds

虽然 运行 我收到错误消息的应用程序 org.apache.catalina.core.StandardWrapperValue 在路径 [/StanWeb] 的上下文中为 servlet [dispatcher] 调用 Servlet.servce() 抛出异常 [An exception在第 [6]

行处理 [views/login.jsp]
<script src="${pageContext.request.contextPath}/js/scripts/jquery.min.js"></script>

我正在使用 Tomcat 版本 9 和 spring-mvc 版本 5。我尝试更改为 request.getContextPath() 但仍然有同样的问题。请帮忙

如评论中所述,您的依赖项之一(activiti-engine) has an alternative implementation of the EL Specification: JUEL

在我看来,这是 activiti-engine 的 POM 中的一个错误:该项目不应依赖于特定的 EL 实现,而应依赖于 EL API。

您可以通过明确排除项目中的 JUEL 依赖项来更正它:

    <dependency>
      <groupId>org.activiti</groupId>
      <artifactId>activiti-engine</artifactId>
      <version>6.0.0</version>
      <exclusions>
        <exclusion>
          <groupId>de.odysseus.juel</groupId>
          <artifactId>juel-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>de.odysseus.juel</groupId>
          <artifactId>juel-impl</artifactId>
        </exclusion>
        <exclusion>
          <groupId>de.odysseus.juel</groupId>
          <artifactId>juel-spi</artifactId>
        </exclusion>
      </exclusions>
    </dependency>