• JBoss & WildFly

    JSP exceeds the 65535 bytes limit

    Exception: The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit
    

    If you can not open a web page due to the JSP servlet limit, then do not forget to add <jsp-config mapped-file="false"/> to standalone.xml or domain.xml in WildFLy. Java has a 64k limit on the size of methods. So when JSP is converted to _jspService method and if the method has exceeded the 64kb limit you get this exception.

    Other solution to fix this issue uses a dynamic include. For example, if you have static include:

    <%@ include file="jspPage.jsp" %>
    # replace this to
    <jsp:include page="newJspPage.jsp" />
    

    Ref: Oracle docs: Including Content in a JSP Page - http://docs.oracle.com/javaee/1.3/tutorial/doc/JSPIntro8.html

    Changing context root in JBoss

    In other words, open jboss-web.xml in directory /src/main/webapp/WEB-INF/ and add:

    <?xml version="1.0" encoding="UTF-8"?>
        <jboss-web>
        <context-root>/app</context-root>
    </jboss-web>
    

    Useful commands

    Show all JNDI in WildFly console:

    $ cd path-to-wildlfy-folder/bin/
    $ ./jboss-cli.sh --connect controller=127.0.0.1
    

    List JNDI resources:

    /subsystem=naming:jndi-view