7 Replies Latest reply on Nov 18, 2010 2:42 PM by stephane_

    java.lang.IllegalArgumentException  on JBOSS

    jian jin Newbie

      The code worked fine on 4.2.3, but on 5.0.1, got such exceptions:

       

      java.lang.IllegalArgumentException
      at java.nio.Buffer.position(Buffer.java:218)
      at org.apache.tomcat.util.buf.B2CConverter.convert(B2CConverter.java:84)
      at org.apache.catalina.connector.InputBuffer.realReadChars(InputBuffer.java:403)
      at org.apache.tomcat.util.buf.CharChunk.substract(CharChunk.java:383)
      at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:416)
      at org.apache.catalina.connector.CoyoteReader.read(CoyoteReader.java:93)

       

      The code is simple and read the data posted from request:

       

      The Reader is get from "httpServletRequest.getReader()"

      public static Document getDocumentFromReader(Reader r) throws IOException,SAXException {
              BufferedReader br = (BufferedReader) r;
              int i;
              StringBuffer sb = new StringBuffer();
              try {
                  while ((i = br.read()) != -1)
                      sb.append((char) i);

       

       

      Is there any guy have ideal about this exception?

        • 1. Re: java.lang.IllegalArgumentException  on JBOSS
          Peter Johnson Master

          Why do you think that this code is responsible for that stack trace? The method you post, getDocumentFromReader, is nowhere in the stack trace.

           

          Where did the stack trace come from? If from the browser, it is usually better to get the corresponding stack trace from the console log. It is also a good idea to post the entire log message containing the stack trace - by posting only a part of the log message you might be ommitting vital or contextual information.

          • 2. Re: java.lang.IllegalArgumentException  on JBOSS
            jian jin Newbie
            Hi Peter,

             

            Actually, the getDocumentFromReader is the last method of ourself's code.

             

            The whole stacktrace:

             

                at  java.nio.Buffer.position(Buffer.java:218)

             

                at  org.apache.tomcat.util.buf.B2CConverter.convert(B2CConverter.java:84)

             

                at  org.apache.catalina.connector.InputBuffer.realReadChars(InputBuffer.java:403)

             

                at  org.apache.tomcat.util.buf.CharChunk.substract(CharChunk.java:383)

             

                at  org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:416)

             

                at  org.apache.catalina.connector.CoyoteReader.read(CoyoteReader.java:93)

             

                at  com.filenet.bp8.api.util.Bp8XMLUtil.getDocumentFromReader(Bp8XMLUtil.java:92)

             

                at  com.filenet.bp8.apps.server.servlet.Bp8ActionDispatcherServlet.doPost(Bp8ActionDispatcherServlet.java:67)

             

                at  javax.servlet.http.HttpServlet.service(HttpServlet.java:637)

             

                at  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

             

                at  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

             

                at  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

             

                at  org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

             

                at  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

             

                at  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

             

                at  org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

             

                at  org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

             

                at  org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

             

                at  org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

             

                at  org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

             

                at  org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

             

                at  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

             

                at  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

             

                at  org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

             

                at  org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

             

                at  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

             

                at  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

             

                at  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)

             

                at  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            • 3. Re: java.lang.IllegalArgumentException  on JBOSS
              jian jin Newbie

              Hi Peter,

               

              Do you need any other informaion?I think jboss 5.0.1 may process http request in a different way, or there is another way to get the http request's content to avoid this exception.

              • 4. Re: java.lang.IllegalArgumentException  on JBOSS
                jian jin Newbie
                can anyone give me an idea about this problem?
                • 5. Re: java.lang.IllegalArgumentException  on JBOSS
                  Michael Sobremonte Newbie

                  A solution to the issue is to upgrade your jbossweb.jar.

                  According to the jira issue, the fix has been committed to the 2.x branch :

                  - https://jira.jboss.org/browse/JBAS-7817?page=com.atlassian.jira.plugin.ext.subversion%3Asubversion-commits-tabpanel#issue-tabs

                   

                  The following steps helped solve similar issues we had on servers with jboss-5.1.0.GA :

                  (taking into account you have a development environment with eclipse and ant) :

                   

                  1. checkout a snapshot which includes the above fix of the jbossweb project from the anon svn :

                     - we used : http://anonsvn.jboss.org/repos/jbossweb/tags/JBOSSWEB_2_1_9_GA/

                  2. apply the attached patch so a jbossweb.jar can be generated (I just commented extra unnecessary resource downloads and compilations).

                     - NOTE : I used eclipse helios to build the jar, so just update the jdt.home and jdt.jar properties in build.properties.default to match the locations of your eclipse and jdt jar locations.

                  3.  run the ant deploy target.

                  4. if your build is successful, a new jbossweb.jar with the fix will be generated under output/jars/jbossweb.jar.

                  5. copy the new jbossweb.jar over the old <bingo_profile>/deploy/jbossweb.sar/jbossweb.jar

                  6. restart jboss.

                   

                   

                  Hope this helps.

                  • 6. Re: java.lang.IllegalArgumentException  on JBOSS
                    Chris X Newbie

                    I encountered the same problem for JBoss AS 5.1. I created the new jbossweb.jar file with the fix. You can download it at the end of this message. I used the following method to create the new jbossweb.jar file:

                     

                    I used eclipse sublipse/svn to download the source at http://anonsvn.jboss.org/repos/jbossweb/tags/JBOSSWEB_2_1_9_GA/ , and add the following 2 jar files in my eclipse build path:

                     

                    1. ant.jar (from ant package downloaded at http://mirror.atlanticmetro.net/apache//ant/binaries/apache-ant-1.8.1-bin.zip) and
                    2. org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar (in eclipse directory, downloaded from http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/helios/SR1/eclipse-jee-helios-SR1-win32.zip).

                     

                    This enables me to compile the whole source code without errors in eclipse. Then I updated two class files (B2CConverter.class, C2BConverter.class) into the jbossweb.jar file which I copied from JBoss AS 5.1. I tested it in my environment, the error is gone.

                     

                    I attached the updated jbossweb.jar file in the message. Hope it helps.

                    • 7. Re: java.lang.IllegalArgumentException  on JBOSS
                      stephane_ Newbie

                      Thanks Chris X , your build saved me a bunch of time !