1 2 Previous Next 15 Replies Latest reply on Nov 2, 2012 4:53 AM by bondchan921

    JBoss AS 5.1.0, JSP truncated to 8KB ???

    bgillis

      Hi guys and Jboss experts,

      I'm currently migrating a webapp from Tomcat 5.5.26 to JBoss 5.1.0.
      Both servers are running on Windows 32bit with Sun JDK 1.6.0_17.
      Unfortunately the migration is not as easy as I would love.

      In this webapp, I've got a JSP tag to handle the application menu.
      This tag writes menu entries to the JSP based on user's profile.

      This tag is quite simple...

      The JSP tag class extends the class javax.servlet.jsp.tagext.TagSupport.
      Only the method doStartTag() is overriden in the JSP tag class.
      The method doStartTag() always returns SKIP_BODY, as the JSP tag is an empty tag.

      The text output is written to the JSP using the following private method :

       public void write(PageContext pageContext, String text) throws JspException {
       JspWriter writer = pageContext.getOut();
       try {
       writer.print(text);
       } catch (IOException e) {
       throw new JspException(e.toString());
       }
       }
      


      Please note that this tag can output more than 50KB of text.

      When I run the webapp in Tomcat 5.5.26, Tomcat 6.0.18 or even JBoss 4.2.3, the menu is always displayed correctly. But as soon as I run the webapp in JBoss 5.1.0, only 8KB or 8912 bytes of the JSP including the JSP tag handling the menu is sent back to the browser ?!?!? So the HTML sent to the browser is incomplete and the page displayed incorrectly. What the heck ? What could have changed between Tomcat 6.0.18 and JBoss Web 2.1.3 (Tomcat fork implementaion in JBoss 5.1.0) ?

      I've already try

      1) to increase the buffer size in the JSP including the JSP tag handling the menu.

      <%@ page buffer="100kb" %>
      


      2) to set the Tomcat system property "org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER" to "false"
      in run.conf.bat.

      set JAVA_OPTS=%JAVA_OPTS% -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=false
      

      None of these solutions has solved the problem.

      Any help would be greatly appreciated.

      Regards,

      Bertrand GILLIS

        • 1. Re: JBoss AS 5.1.0, JSP truncated to 8KB or 8192 bytes ???
          bgillis

          I also try to run my webapp in JBoss Web 2.1.4 (standalone). And my webapp is working flawlessly. So the issue must come from JBoss AS 5.1.0. Does anyone know if JBoss AS force any parameter that might rise this issue ? I couldn't find any information on JBoss forums nor JBoss wiki.

          Is there any JBoss expert available to give me some assistance or clues on this issues ?

          Bertrand

          • 2. Re: JBoss AS 5.1.0, JSP truncated to 8KB or 8192 bytes ???
            alesj

             

            "bgillis" wrote:

            Is there any JBoss expert available to give me some assistance or clues on this issues ?

            If in a hurry: http://www.jboss.com/services/consulting/ ;-)

            • 3. Re: JBoss AS 5.1.0, JSP truncated to 8KB or 8192 bytes ???
              bgillis

               

              "alesj" wrote:

              If in a hurry: http://www.jboss.com/services/consulting/ ;-)


              Well I have no doubt about that... but I'm a bit suprised that nobody on the JBoss community want to share any experience about this issue... even on JBoss.com. It might be a bug in JBoss AS 5.1.0 source code.

              At first, I just want to know if I'm missing any configuration parameter on JBoss AS or if it's the right behavior (JSP Specifications implementation on JBoss AS)... mostly to be more confident about how to solve this issue.

              I don't really want to spend $$$ to hire some expert at JBoss if this issue is not really an issue.

              • 4. Re: JBoss AS 5.1.0, JSP truncated to 8KB or 8192 bytes ???
                alesj

                 

                "bgillis" wrote:

                I don't really want to spend $$$ to hire some expert at JBoss if this issue is not really an issue.

                Sure, but you're pretty impatient - waiting only 6h.

                You need to understand the concept of this free forum.
                It's not like you're the only one who needs help,
                and other users or devs would just jump onto the topic and dig into your problem.

                And since this is the first time something similar is reported (afaik),
                it might be that you're the first one to experience this
                or at least there are very very limited number of users who've seen similar issue,
                hence they hardly fall into "check forum every 6h" group.

                btw: what does Google say about it

                ;-)

                ps: I doubt this is JBoss bug, as I'm pretty sure there is plenty of Seam users who have tag outputs bigger than 8K


                • 5. Re: JBoss AS 5.1.0, JSP truncated to 8KB ???
                  bgillis

                   

                  "alesj" wrote:
                  Sure, but you're pretty impatient - waiting only 6h.

                  You need to understand the concept of this free forum.
                  It's not like you're the only one who needs help,
                  and other users or devs would just jump onto the topic and dig into your problem.


                  All my apologies if I seemed to be impatient. I just wanted to provide additional information that might help. I've been trying to solve this issue myself since 2 days... without seeing the light. So I understand what you are talking about ;-) To be honest, this issue drives me crazy.

                  "alesj" wrote:
                  I doubt this is JBoss bug, as I'm pretty sure there is plenty of Seam users who have tag outputs bigger than 8K


                  I've also tried to reproduce this issue with another JSP tag but I failed. So that's exactly what I think at first. But I can't figure out why the issue only happens in JBoss AS 5.1.0 and only on this tag as soon as the JSP output exceeds 8KB. As a matter of fact, 8KB is used a lot of times as the default buffer size for several Java objects in JBoss AS. It can't be a coincidence.

                  Tomorrow morning, I will provide the source code of the JSP tag, a sample of the expected output and the truncated output of the JSP including the tag.

                  • 6. Re: JBoss AS 5.1.0, JSP truncated to 8KB ???
                    bgillis

                    Well... as promissed yesterday, I uploaded this archive file.

                    This file contains :
                    - MenuTag.java, source code of the JSP tag,
                    - mainsys.tld, tag library where this tag belongs to,
                    - menu.jsp, source code of the JSP,
                    - menu.jsp_expected.html, the expected output text,
                    - menu.jsp_truncated.html, the truncated output text in JBoss 5.1.0.

                    Please be indulgent with the quality of the source code.
                    I'm not the developer at all but only the debugger man ;-)

                    Thanks in advance for your help.

                    • 7. Re: JBoss AS 5.1.0, JSP truncated to 8KB ???
                      bgillis

                      After several days of hair pulling, I've finally found the cause of the issue.

                      To summarize... the Jsp tag writes menu entries to the Jsp based on user's profile. User's profile is obtained from an Oracle database. This morning I discovered that a character within a menu label is the cause of the issue.

                      Usually, we are using a special character (unicode reference: U+0027, Apostrophe) in french labels as in the following label:

                      Annulation d'un dividende


                      But in two of the french labels, another character was used instead (unicode reference: U+2019, Right Single Quotation Mark).

                      This last character doesn't seem to be correctly interpreted in JBoss AS 5.0.x and 5.1.x. When the text stream is written to the JspWriter, the current buffer is flushed and the response output stream is closed even if the Jsp is not completely interpreted yet. As a consequence the html output sent back to the browser is then incomplete.

                      I was also able to reproduce this issue with another Jsp tag writing this character in a Jsp. As far as I know, this character is encoded in 3 bytes instead of 1 bytes for the apostrophe character. As the character encoding on our server is ISO-8859-1, I say to myself that it could be a solution to force the content type of the Jsp with the following instruction in the Jsp:

                      <%@ page contentType="text/html; charset=UTF-8" %>


                      And guess what ? The issue has disappeared automagically ! No more truncated Jsp.

                      Unfortunately I still don't understand why this issue happens only in the lastest versions of JBoss AS (5.0.x and 5.1.x)... and not in Tomcat nor in JBoss Web nor in the previous version of Jboss AS.

                      I'd really like to have an advice from a JBoss expert on that issue because it seems a critical issue to me... and I don't want to create a new JIRA if it's not a JBoss AS issue at all.

                      • 8. Re: JBoss AS 5.1.0, JSP truncated to 8KB ???
                        vickyk

                        You should be asking help in JbossWeb forums as the problem posted is specific to JBossWeb component probabily jasper related!

                        • 9. Re: JBoss AS 5.1.0, JSP truncated to 8KB ???
                          bgillis

                           

                          "vickyk" wrote:
                          You should be asking help in JbossWeb forums as the problem posted is specific to JBossWeb component probabily jasper related!


                          Thanks Vicky... Unfortunately this issue doesn't happen when deploying the webapp directly to JBoss Web (standalone). So it might be a side effect of JBoss Web inside JBoss AS. That why I've asked help in JBoss AS forum at first.

                          But I will ask also advices in JBoss Web Forum as suggested.

                          • 10. Re: JBoss AS 5.1.0, JSP truncated to 8KB ???
                            bgillis

                             

                            "bgillis" wrote:
                            But I will ask also advices in JBoss Web Forum as suggested.

                            You will find the corresponding post in JBoss Web Users Forum.

                            • 11. Re: JBoss AS 5.1.0, JSP truncated to 8KB ???
                              jaikiran
                              • 12. Re: JBoss AS 5.1.0, JSP truncated to 8KB ???
                                bgillis

                                well... I wouldn't call this a coincidence if several users are reporting the same kind of issue :-)

                                Even if I was able to fix temporarily the problem adding the following snippet to the Jsp source:

                                <%@ page contentType="text/html; charset=UTF-8" %>


                                it doesn't seem to be the correct behaviour in JBoss AS.

                                • 13. Re: JBoss AS 5.1.0, JSP truncated to 8KB ???
                                  alesj
                                  • 14. Re: JBoss AS 5.1.0, JSP truncated to 8KB ???
                                    bgillis

                                    Thanks Ales for pointing me to this Jira. I haven't found this one yet ;-) Maybe I didn't use the right keywords with Jira search engine.

                                    I tested this morning the webapp provided by Juan Manuel Medina Apodaca in JBoss Web 2.1.2 and in JBoss AS 5.1.x. And I was able to see a result similar to my issue with both servers. And as soon as I deploy this war in JBoss Web 2.1.4, the issue is gone as commented by Remy Maucherat.

                                    I also tried my own webapp (full details available here) and noted the same results.

                                    Is there any bug fix release scheduled for JBoss AS 5.1.x ? Otherwise, are there any ways to patch JBoss AS 5.1.x with the lastest available version of JBoss Web (2.1.4) ?

                                    1 2 Previous Next