Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-44218

Samigo > remove JSTL

    XMLWordPrintable

    Details

    • 20 status:
      Resolved
    • Test Plan:
      1. Create and publish a quiz
      2. Take the quiz as a student
        1. PASS: able to take and submit quiz
        2. FAIL: quiz does not load after clicking "Begin Assessment"

      Description

      I've now encountered 3 environments where students are unable to begin a quiz. The cause is:

      org.sakaiproject.tool.api.ToolException: org.apache.jasper.JasperException: The absolute uri: [http://java.sun.com/jsp/jstl/core] cannot be resolved in either web.xml or the jar files deployed with this application
              at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.forward(ActiveToolComponent.java:520)
              at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1501)
              at org.sakaiproject.portal.charon.handlers.SiteHandler.doToolBuffer(SiteHandler.java:1241)
              at org.sakaiproject.portal.charon.handlers.SiteHandler.bufferContent(SiteHandler.java:1075)
              at org.sakaiproject.portal.charon.handlers.SiteHandler.doSite(SiteHandler.java:498)
              at org.sakaiproject.portal.charon.handlers.SiteHandler.doGet(SiteHandler.java:274)
              at org.sakaiproject.portal.charon.handlers.SiteHandler.doGet(SiteHandler.java:162)
              at org.sakaiproject.portal.charon.handlers.WorksiteHandler.doPost(WorksiteHandler.java:69)
              at org.sakaiproject.portal.charon.SkinnableCharonPortal.doPost(SkinnableCharonPortal.java:1183)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:475)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
              at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
              at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
              at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
              at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)
              at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589)
              at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
              at java.lang.Thread.run(Thread.java:748)
      Caused by: org.apache.jasper.JasperException: The absolute uri: [http://java.sun.com/jsp/jstl/core] cannot be resolved in either web.xml or the jar files deployed with this application
              at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
              at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:294)
              at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:81)
              at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:251)
              at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:122)
              at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431)
              at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:489)
              at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1445)
              at org.apache.jasper.compiler.Parser.parse(Parser.java:144)
              at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
              at org.apache.jasper.compiler.ParserController.parse(ParserController.java:105)
              at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:206)
              at org.apache.jasper.compiler.Compiler.compile(Compiler.java:385)
              at org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
              at org.apache.jasper.compiler.Compiler.compile(Compiler.java:346)
              at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
              at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
              at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
              at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:426)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
              at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
              at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384)
              at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
              at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:791)
              at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:380)
              at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:130)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:223)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:426)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
              at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
              at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384)
              at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
              at org.sakaiproject.jsf.util.SamigoJsfTool.dispatch(SamigoJsfTool.java:360)
              at org.sakaiproject.jsf2.util.JsfTool.doPost(JsfTool.java:250)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
              at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
              at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:352)
              at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
              at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.forward(ActiveToolComponent.java:508)
              ... 35 more
      

      I've seen this happen in both a 20.x and 21.x environment (even as of this morning). Cleaning out Tomcat and doing a full redeploy does not resolve the problem.

      It's a strange issue; it doesn't seem to crop up all the time. This morning I could reproduce it in master locally, but not on nightly.

      The use of this library in Samigo is extremely limited. It's only used on one page, deliveryAssessment.jsp:

      <%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix="c" %>
      

      I've looked into this and tried several things. As per this StackOverflow article, I have confirmed the following:

      • The URI is in fact the correct one for JSTL 1.2:
        <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
        
      • There is no import of the taglibs:standard library in samigo-app/pom.xml
      • The jstl 1.2 jar is deployed to samigo-app's WEB-INF/lib:
        .././webapps/samigo-app/WEB-INF/lib/jstl-1.2.jar
        
        • This also verifies that the library is not marked as being provided, because it is deployed to the webapp's internal lib, rather than Tomcat's provided lib
      • web.xml conforms to a Servlet spec greater than or equal to 2.4 (it's using Servlet 3.1):
        <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
                 http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
                 version="3.1">
        
      • web.xml does not contain a <!DOCTYPE> declaration anywhere in the file

      As suggested in several StackOverflow articles [1][2], I also tried removing taglibs-standard-spec*.jar from the jarsToSkip list, and added tags-.jar, taglibs.jar, and jstl*.jar to the jarsToScan list in Tomcat's catalina.properties file:

      tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\
      ...
      #taglibs-standard-spec-*.jar,\
      ...
      ...
      tomcat.util.scan.StandardJarScanFilter.jarsToScan=\
      tags-*.jar,\
      taglibs*.jar,\
      jstl*.jar,\
      ...
      

      This did not resolve the problem.

      [1] https://stackoverflow.com/a/34690353
      [2] https://stackoverflow.com/a/54315323

      I ran out of ideas after this, and thought to myself: why are we using the JSTL library here? As I mentioned earlier, it's only used in one specific JSP file, and only for a very few select tags. Specifically, the following chunk of code:

      <c:if test="${not empty delivery.dueDate}">
      	<h:inputHidden id="dueDate" value="#{delivery.dueDate.time}"/>
      </c:if>
      <c:if test="${not empty delivery.retractDate}">
      	<h:inputHidden id="retractDate" value="#{delivery.retractDate.time}"/>
      </c:if>
      <c:if test="${not empty delivery.minutesLeft}">
      	<h:inputHidden id="minutesLeft" value="#{delivery.minutesLeft}"/>
      </c:if>
      <c:if test="${not empty delivery.secondsLeft}">
      	<h:inputHidden id="secondsLeft" value="#{delivery.secondsLeft}"/>
      </c:if>
      

      After thinking about this code for a few minutes, it seems really silly to import an entirely library just to use what amounts to an if statement. Especially considering that the JSF inputHidden tag has it's own rendered attribute, which you can define an EL expression to determine if the element should be rendered or not.

      So, I simply removed the <c:if> tags, and translated the condition within them to an EL expression which I then put inside the rendered attribute for each of the <h:inputHidden> tags. Then I removed the tag library import from the JSP, and removed the JSTL library import from samigo-app/pom.xml, cleaned Tomcat, redeployed, retested.

      Now able to take quizzes again.

        Gliffy Diagrams

          Zeplin

            Attachments

              Activity

                People

                Assignee:
                bjones86 Brian Jones
                Reporter:
                bjones86 Brian Jones
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Git Integration