加载applet时的getWriter()异常

时间:2015-12-19 11:39:47

标签: java applet glassfish-4.1

我有一个相当大的applet(54,000行代码),它提供了无数的:

    java.lang.IllegalStateException: getWriter() has already been called for this response
正在加载所需的applet库时

-exceptions。我能说的最好,它们不是由我的代码直接造成的。该页面是在Glassfish 4.1上运行的JSF 2.2 xhtml。

我正在使用applet标记,因为Object标记不支持百分比宽度。

<applet code="org.appletinterface.CriteriaInterface.class" 
        archive="CriteriaInterfaceApplet.jar, lib/AbsoluteLayout.jar, lib/appframework-1.0.3.jar, lib/beansbinding-1.2.1.jar, lib/SearchCriteriaEditor.jar, lib/swing-worker-1.1.jar" 
        id="criteriaApplet"
        width="100%" 
        height="1600"
        centerimage="false"
        >
</applet>

小程序加载正常,但我想在开始beta测试之前摆脱这些错误。它每次吐出11,183行这些错误,所以它不容易被忽略。

我正处于启动4年144,000线项目(我是唯一的程序员)的尖端,并且在发布之前我已经没时间了,所以我们将非常感谢任何帮助。

更新:我偶然检查了另一个导致applet暂时冻结的错误。问题是在jPanel上设置背景导致在下面列出的第二批错误中发生完全相同的两个错误。生成了很多错误,导致applet在输出到Netbeans控制台时冻结。这个jPanel有绑定来设置其他几个面板的背景颜色,所以我只需要设置一个面板的背景颜色。

删除绑定并手动更改其他面板的颜色可解决问题。使用Try-Catch设置背景颜色不会捕获任何错误。然而,当applet加载时我仍然有错误,我仍在调查。是否有其他方法来捕获错误,例如背景问题,哪些尝试捕获缺失?

小程序开始加载时产生的初始错误是以下四次:

        INFO:   Exception when handling error trying to reset the response.
    java.io.IOException: An existing connection was forcibly closed by the remote host
        at sun.nio.ch.SocketDispatcher.write0(Native Method)
        at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
        at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
        at sun.nio.ch.IOUtil.write(IOUtil.java:51)
        at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
        at org.glassfish.grizzly.nio.transport.TCPNIOUtils.flushByteBuffer(TCPNIOUtils.java:149)
        at org.glassfish.grizzly.nio.transport.TCPNIOUtils.writeCompositeBuffer(TCPNIOUtils.java:87)
        at org.glassfish.grizzly.nio.transport.TCPNIOAsyncQueueWriter.write0(TCPNIOAsyncQueueWriter.java:112)
        at org.glassfish.grizzly.nio.transport.TCPNIOAsyncQueueWriter.write0(TCPNIOAsyncQueueWriter.java:91)
        at org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.processAsync(AbstractNIOAsyncQueueWriter.java:333)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:108)
        at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.executeIoEvent(WorkerThreadIOStrategy.java:103)
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.executeIoEvent(AbstractIOStrategy.java:89)
        at org.glassfish.grizzly.nio.SelectorRunner.iterateKeyEvents(SelectorRunner.java:414)
        at org.glassfish.grizzly.nio.SelectorRunner.iterateKeys(SelectorRunner.java:383)
        at org.glassfish.grizzly.nio.SelectorRunner.doSelect(SelectorRunner.java:347)
        at org.glassfish.grizzly.nio.SelectorRunner.run(SelectorRunner.java:278)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
        at java.lang.Thread.run(Thread.java:744)

然后开始getWriter()错误;这两个可以重复多达30次:

            WARNING:   Servlet.service() for servlet default threw exception
    java.lang.IllegalStateException: getWriter() has already been called for this response
        at org.apache.catalina.connector.Response.getOutputStream(Response.java:746)
        at org.apache.catalina.connector.ResponseFacade.getOutputStream(ResponseFacade.java:206)
        at javax.servlet.ServletResponseWrapper.getOutputStream(ServletResponseWrapper.java:142)
        at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1026)
        at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:568)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at sun.reflect.GeneratedMethodAccessor1330.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:323)
        at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:321)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:536)
        at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:356)
        at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:214)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1676)
        at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:875)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
        at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:695)
        at org.apache.catalina.core.ApplicationDispatcher.access$100(ApplicationDispatcher.java:98)
        at org.apache.catalina.core.ApplicationDispatcher$PrivilegedInclude.run(ApplicationDispatcher.java:201)
        at org.apache.catalina.core.ApplicationDispatcher$PrivilegedInclude.run(ApplicationDispatcher.java:190)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:618)
        at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:500)
        at org.apache.catalina.core.StandardHostValve.dispatchToErrorPage(StandardHostValve.java:699)
        at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:380)
        at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:234)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:417)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
        at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
        at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
        at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
        at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
        at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
        at java.lang.Thread.run(Thread.java:744)

    WARNING:   org.apache.catalina.core.StandardHostValve@18bc551: Exception Processing ErrorPage[errorCode=404, location=/PageNotFoundRedirect.xhtml]
    java.lang.IllegalStateException: getWriter() has already been called for this response
        at org.apache.catalina.connector.Response.getOutputStream(Response.java:746)
        at org.apache.catalina.connector.ResponseFacade.getOutputStream(ResponseFacade.java:206)
        at javax.servlet.ServletResponseWrapper.getOutputStream(ServletResponseWrapper.java:142)
        at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1026)
        at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:568)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at sun.reflect.GeneratedMethodAccessor1330.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:323)
        at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:321)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:536)
        at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:356)
        at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:214)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1676)
        at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:875)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
        at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:695)
        at org.apache.catalina.core.ApplicationDispatcher.access$100(ApplicationDispatcher.java:98)
        at org.apache.catalina.core.ApplicationDispatcher$PrivilegedInclude.run(ApplicationDispatcher.java:201)
        at org.apache.catalina.core.ApplicationDispatcher$PrivilegedInclude.run(ApplicationDispatcher.java:190)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:618)
        at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:500)
        at org.apache.catalina.core.StandardHostValve.dispatchToErrorPage(StandardHostValve.java:699)
        at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:380)
        at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:234)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:417)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
        at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
        at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
        at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
        at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
        at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
        at java.lang.Thread.run(Thread.java:744)

0 个答案:

没有答案