Hi all,
Recently we were having some issue with one application and getting below exceptions as below:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
15:44:21,728 ERROR [org.apache.coyote.ajp.AjpMessage] Cannot append null value
java.lang.NullPointerException
at org.apache.coyote.ajp.AjpMessage.appendString(AjpMessage.java:242)
at org.apache.coyote.ajp.AjpMessage.appendBytes(AjpMessage.java:178)
at org.apache.coyote.ajp.AjpAprProcessor.prepareResponse(AjpAprProcessor.java:975)
at org.apache.coyote.ajp.AjpAprProcessor.action(AjpAprProcessor.java:484)
at org.apache.coyote.Response.action(Response.java:186)
at org.apache.coyote.Response.sendHeaders(Response.java:386)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:333)
at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:299)
at org.apache.catalina.connector.Response.finishResponse(Response.java:495)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346)
at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:419)
at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:403)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2036)
at java.lang.Thread.run(Thread.java:662)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
After analysis, it seems there is some issue with header passing i.e. null header is getting passed resulting in above Exceptions. We have enabled some logging to confirm same as below.
However the NullPointerException here is actually expected behaviour when given a null header. If JBoss receives a message with a malformed header like this, it should throw an exception, so it is believed this issue is external and from the application and there may not be anything to fix here in JBoss itself, just in the application code.
- Turn on the "RequestDumperValve" in the 'jbossweb.sar/server.xml' and inspect request for any unusual headers.
- Check the web.xml from the application, and the deployer's web.xml, for any missing param-values.
After implementing the above, You will see the logs as below :
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2013-03-11 15:50:01,696 INFO ] REQUEST URI =/QRUserExperience-1.0/getUrl/adasd224
2013-03-11 15:50:01,697 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] authType=null
2013-03-11 15:50:01,698 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] characterEncoding=null
2013-03-11 15:50:01,698 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] contentLength=-1
2013-03-11 15:50:01,698 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] contentType=null
2013-03-11 15:50:01,698 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] contextPath=/QRUserExperience-1.0
2013-03-11 15:50:01,699 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] cookie=NLSessionSnoauthmcd=6+5BtzKQNoCtHxI/nSR/x7SFBkhNfAkpDd1lCVXYzmaih8ykkBN8bd+8LWkWaAqsIXhN4HrENZFIsUzRABN+TirfPErpoGxRlrjCUrKuR3UhfalV9Ss0LgW+xBIyBlCU
2013-03-11 15:50:01,699 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] cookie=GlobalAS-SessionId=e8643a31-891c-4dbd-9e2e-e965ba2aab23
2013-03-11 15:50:01,699 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] cookie=UserLanguageCode=en
2013-03-11 15:50:01,701 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=host=q-dev.mcd.com
2013-03-11 15:50:01,701 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=user-agent=Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25
2013-03-11 15:50:01,701 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
2013-03-11 15:50:01,701 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=accept-language=en-us,en;q=0.5
2013-03-11 15:50:01,701 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=accept-encoding=gzip,deflate
2013-03-11 15:50:01,701 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=accept-charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7
2013-03-11 15:50:01,701 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=Keep-Alive=115
2013-03-11 15:50:01,701 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=connection=keep-alive
2013-03-11 15:50:01,702 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=cookie=NLSessionSnoauthmcd=6+5BtzKQNoCtHxI/nSR/x7SFBkhNfAkpDd1lCVXYzmaih8ykkBN8bd+8LWkWaAqsIXhN4HrENZFIsUzRABN+TirfPErpoGxRlrjCUrKuR3UhfalV9Ss0LgW+xBIyBlCU; GlobalAS-SessionId=e8643a31-891c-4dbd-9e2e-e965ba2aab23; UserLanguageCode=en
2013-03-11 15:50:01,702 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] locale=en_US
2013-03-11 15:50:01,702 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] method=GET
2013-03-11 15:50:01,703 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] pathInfo=/adasd224
2013-03-11 15:50:01,703 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] protocol=HTTP/1.1
2013-03-11 15:50:01,703 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] queryString=null
2013-03-11 15:50:01,703 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] remoteAddr=192.8.220.34
2013-03-11 15:50:01,703 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] remoteHost=192.8.220.34
2013-03-11 15:50:01,703 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] remoteUser=null
2013-03-11 15:50:01,703 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] requestedSessionId=null
2013-03-11 15:50:01,703 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] scheme=https
2013-03-11 15:50:01,704 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] serverName=q-dev.mcd.com
2013-03-11 15:50:01,704 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] serverPort=443
2013-03-11 15:50:01,704 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] servletPath=/getUrl
2013-03-11 15:50:01,704 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] isSecure=true
2013-03-11 15:50:01,704 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] ---------------------------------------------------------------
2013-03-11 15:50:02,240 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] ---------------------------------------------------------------
2013-03-11 15:50:02,240 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] authType=null
2013-03-11 15:50:02,240 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] contentLength=-1
2013-03-11 15:50:02,240 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] contentType=null
2013-03-11 15:50:02,241 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=X-Powered-By=Servlet 2.5; JBoss-5.0/JBossWeb-2.1
2013-03-11 15:50:02,241 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=Location=null
2013-03-11 15:50:02,241 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] message=null
2013-03-11 15:50:02,241 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] remoteUser=null
2013-03-11 15:50:02,241 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] status=302
2013-03-11 15:50:02,241 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Thanks!!