The following code results in Null pointer exception on Glassfish V2
UR1 (please see stack trace at the end of this email):
test.jsp
<%
try {
java.net.ServerSocket listenSocket = new java.net.ServerSocket();
listenSocket.setReceiveBufferSize(1000000);
} catch (Exception ex) {
out.print("Exception : "+ex);
ex.printStackTrace(new java.io. PrintWriter(out));
}
%>
http://java.sun.com/j2se/1.5.0/docs/api/java/net/ServerSocket.html#setReceiveBufferSize(int)
seems to indicate its perfectly legal to do this :
"However, if the application wishes to allow a receive window larger
than 64K bytes, as defined by RFC1323 then the proposed value must be
set in the ServerSocket before it is bound to a local address. This
implies, that the ServerSocket must be created with the no-argument
constructor, then setReceiveBufferSize() must be called and lastly the
ServerSocket is bound to an address by calling bind()."
Stack trace:
Exception :
java.lang.NullPointerExceptionjava.lang.NullPointerException at
com
.sun
.enterprise
.server
.ss.provider.ASServerSocketImpl.setOption(ASServerSocketImpl.java:207)
at java.net.ServerSocket.setReceiveBufferSize(ServerSocket.java:741)
at org.apache.jsp.stest_jsp._jspService(stest_jsp.java:49) at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at
org
.apache
.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
470) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:
364) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.servletService(ApplicationFilterChain.java:
411) at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
317) at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at com.sun.identity.setup.AMSetupFilter.doFilter(AMSetupFilter.java:
91) at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
230) at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at
org
.apache
.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
288) at
org
.apache
.catalina
.core.StandardContextValve.invokeInternal(StandardContextValve.java:
271) at
org
.apache
.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
202) at
org
.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
632) at
org
.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
577) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at
org
.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
206) at
org
.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
632) at
org
.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
577) at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
571) at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at
org
.apache
.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
150) at
org
.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
632) at
org
.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
577) at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
571) at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:
272) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter
(DefaultProcessorTask.java:637) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess
(DefaultProcessorTask.java:568) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process
(DefaultProcessorTask.java:813) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask
(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask
(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask
(DefaultReadTask.java:214) at com.sun.enterprise.web.portunif.PortUnificationPipeline
$PUTask.doTask(PortUnificationPipeline.java:380) at com.sun.enterprise.web.connector.grizzly.TaskBase.run
(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run
(SSLWorkerThread.java:106)
Known bug?
-rajeev