Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-4362

Web container (undertow) isn't able to compile JSPs containing JDK 8 specific code (lambda expressions)

    XMLWordPrintable

Details

    Description

      Accessing JSP with JDK8 specific code (namely lambda expressions) fails due compilation error [1].

      It didn't help setting

      <jsp-config source-vm="1.8" target-vm="1.8"/> in <servlet-container name="default">
      

      It is caused due ecj-4.3.1.jar supports only JDKs till 1.7.

      [1]

      09:58:44,480 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /lambda-expression-test/jsp-with-lambdas.jsp: org.apache.jasper.JasperException: JBWEB004062: Unable to compile class for JSP: 
      
      JBWEB004060: An error occurred at line: 10 in the jsp file: /jsp-with-lambdas.jsp
      n cannot be resolved to a variable
      7: //    System.out.println(answerToEverything);
      8: 
      9:     List<Integer> list = Arrays.asList(1, 2, 3);
      10:     Arrays.asList(1).forEach(n-> System.out.println(n));
      11: 
      12:     list.forEach(n -> response.getWriter().write("<p>" + n + "</p>"));
      13: 
      
      
      JBWEB004060: An error occurred at line: 10 in the jsp file: /jsp-with-lambdas.jsp
      Syntax error on token "-", -- expected
      7: //    System.out.println(answerToEverything);
      8: 
      9:     List<Integer> list = Arrays.asList(1, 2, 3);
      10:     Arrays.asList(1).forEach(n-> System.out.println(n));
      11: 
      12:     list.forEach(n -> response.getWriter().write("<p>" + n + "</p>"));
      13: 
      
      
      JBWEB004060: An error occurred at line: 10 in the jsp file: /jsp-with-lambdas.jsp
      n cannot be resolved to a variable
      7: //    System.out.println(answerToEverything);
      8: 
      9:     List<Integer> list = Arrays.asList(1, 2, 3);
      10:     Arrays.asList(1).forEach(n-> System.out.println(n));
      11: 
      12:     list.forEach(n -> response.getWriter().write("<p>" + n + "</p>"));
      13: 
      
      
      JBWEB004060: An error occurred at line: 12 in the jsp file: /jsp-with-lambdas.jsp
      n cannot be resolved to a variable
      9:     List<Integer> list = Arrays.asList(1, 2, 3);
      10:     Arrays.asList(1).forEach(n-> System.out.println(n));
      11: 
      12:     list.forEach(n -> response.getWriter().write("<p>" + n + "</p>"));
      13: 
      14: %>
      15: </body>
      
      
      JBWEB004060: An error occurred at line: 12 in the jsp file: /jsp-with-lambdas.jsp
      Syntax error on token "-", -- expected
      9:     List<Integer> list = Arrays.asList(1, 2, 3);
      10:     Arrays.asList(1).forEach(n-> System.out.println(n));
      11: 
      12:     list.forEach(n -> response.getWriter().write("<p>" + n + "</p>"));
      13: 
      14: %>
      15: </body>
      
      
      JBWEB004060: An error occurred at line: 12 in the jsp file: /jsp-with-lambdas.jsp
      n cannot be resolved to a variable
      9:     List<Integer> list = Arrays.asList(1, 2, 3);
      10:     Arrays.asList(1).forEach(n-> System.out.println(n));
      11: 
      12:     list.forEach(n -> response.getWriter().write("<p>" + n + "</p>"));
      13: 
      14: %>
      15: </body>
      
      
      JBWEB004211: Stacktrace:
      	at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85) [jastow-1.0.0.Final.jar:1.0.0.Final]
      	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:69) [jastow-1.0.0.Final.jar:1.0.0.Final]
      	at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:451) [jastow-1.0.0.Final.jar:1.0.0.Final]
      	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:361) [jastow-1.0.0.Final.jar:1.0.0.Final]
      	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:339) [jastow-1.0.0.Final.jar:1.0.0.Final]
      	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:326) [jastow-1.0.0.Final.jar:1.0.0.Final]
      	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:604) [jastow-1.0.0.Final.jar:1.0.0.Final]
      	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:309) [jastow-1.0.0.Final.jar:1.0.0.Final]
      	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jastow-1.0.0.Final.jar:1.0.0.Final]
      	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259) [jastow-1.0.0.Final.jar:1.0.0.Final]
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
      	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_75]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_75]
      	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]
      
      

      Attachments

        Activity

          People

            tomazcerar Toma┼ż Cerar (Inactive)
            rhatlapa@redhat.com Radim Hatlapatka (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: