[jboss-jira] [JBoss JIRA] (WFLY-4362) Web container (undertow) isn't able to compile JSPs containing JDK 8 specific code (lambda expressions)

Tomaz Cerar (JIRA) issues at jboss.org
Thu Feb 19 08:24:51 EST 2015


    [ https://issues.jboss.org/browse/WFLY-4362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041905#comment-13041905 ] 

Tomaz Cerar commented on WFLY-4362:
-----------------------------------

Main fix is in jastow (jasper fork for undertow)
btw, your example doesn't compile properly on jdk8.

it complains with
{quote}
JBWEB004060: An error occurred at line: 10 in the jsp file: /jsp-with-lambdas.jsp
Unhandled exception type IOException
{quote}

> Web container (undertow) isn't able to compile JSPs containing JDK 8 specific code (lambda expressions)
> -------------------------------------------------------------------------------------------------------
>
>                 Key: WFLY-4362
>                 URL: https://issues.jboss.org/browse/WFLY-4362
>             Project: WildFly
>          Issue Type: Bug
>          Components: Web (Undertow)
>    Affects Versions: 9.0.0.Alpha1
>         Environment: jdk1.8
>            Reporter: Radim Hatlapatka
>            Assignee: Tomaz Cerar
>            Priority: Critical
>         Attachments: lambda-expression-test.war
>
>
> Accessing JSP with JDK8 specific code (namely lambda expressions) fails due compilation error [1].
> It didn't help setting  
> {code}
> <jsp-config source-vm="1.8" target-vm="1.8"/> in <servlet-container name="default">
> {code}
> It is caused due ecj-4.3.1.jar supports only JDKs till 1.7.
> [1]
> {noformat}
> 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]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the jboss-jira mailing list