项目中使用了dwr的comet推送功能,在tomcat服务器小正常,但是在jetty下报错:
2012-11-12 11:14:35,853 WARN [org.directwebremoting.server.jetty.JettyContinuationSleeper] - Exception
java.lang.NullPointerException
at org.directwebremoting.util.Continuation.suspend(Continuation.java:76)
at org.directwebremoting.server.jetty.JettyContinuationSleeper.goToSleep(JettyContinuationSleeper.java:92)
at org.directwebremoting.dwrp.BasePollHandler.handle(BasePollHandler.java:234)
at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:120)
at org.directwebremoting.spring.DwrController.handleRequestInternal(DwrController.java:232)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1329)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1300)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:445)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:534)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1038)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:374)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:972)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:363)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:931)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:992)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:619)
项目主要配置文件如下: dwr的配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.directwebremoting.org/schema/spring-dwr
http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">
<!-- <dwr:annotation-config />
<tx:annotation-driven />
<dwr:configuration />
<dwr:annotation-config />
<dwr:url-mapping />
<dwr:controller id="dwrController" debug="true" />-->
<!-- <context:component-scan base-package="com.vancl.callcenter.module.monitor.agent" />-->
<dwr:annotation-scan scanRemoteProxy="true" base-package="com.vancl.callcenter.module.agentmonitor.dwr" />
<dwr:url-mapping />
<dwr:controller id="dwrController" debug="true" >
<dwr:config-param name="activeReverseAjaxEnabled" value="true" />
</dwr:controller>
<!-- <bean name="/hello" class="com.vancl.callcenter.module.monitor.agent.controller.HelloController"/>-->
<bean id="pullTaskStatusUtils" name="pullTaskStatusUtils" class="com.vancl.callcenter.module.agentmonitor.dwr.PullTaskStatusUtils">
<dwr:remote javascript="pullTaskStatusUtils">
<dwr:include method="show" />
</dwr:remote>
</bean>
<bean id="peopleTable" name="peopleTable" class="com.vancl.callcenter.module.sessionscript.dwr.PeopleTable">
<dwr:remote javascript="peopleTable">
</dwr:remote>
</bean>
<bean id="agentMonitor" name="agentMonitor" class="com.vancl.callcenter.module.agentmonitor.job.AgentMonitorJob">
<dwr:remote javascript="agentMonitor">
</dwr:remote>
</bean>
</beans>
web.xml 文件:
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:controller-servlet.xml,
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>*.shtm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
jsp页面: <script type='text/javascript' src='<%=path%>/dwr/engine.js'></script>
<script type='text/javascript'
src='<%=path%>/dwr/interface/pullTaskStatusUtils.js'></script>
<script type='text/javascript'
src='<%=path%>/dwr/interface/agentMonitor.js'></script>
<script type='text/javascript' src='<%=path%>/dwr/util.js'></script>
<SCRIPT language="javascript" src="<%=path%>/js/jquery-1.7.1.min.js"></SCRIPT>
window.onload=function()
{
dwr.engine.setActiveReverseAjax(true); // Initiate reverse ajax polling
//dwr.engine.setErrorHandler(errorHandler); // Called when a call and all retry attempts fail
//dwr.engine.setPollStatusHandler(updatePollStatus); // Optional function to call when the reverse ajax status changes (e.g. online to offline)
//updatePollStatus(true); // Optional - We are online right now! Until DWR determines we are not!
dwr.engine.setNotifyServerOnPageUnload(true); // Optional - When the page is unloaded, remove this ScriptSession.
//Tabs.init('tabList', 'tabContents'); // Initialize the tabs for this display
agentMonitor.task(); // Make a call to the server to begin updating the table!
//addAttributeToScriptSession(); // Make a remote call to the server to add an attribute onto the ScriptSession which will be used in determining what pages receive updates!
}
2012-11-12 11:14:35,853 WARN [org.directwebremoting.server.jetty.JettyContinuationSleeper] - Exception
java.lang.NullPointerException
at org.directwebremoting.util.Continuation.suspend(Continuation.java:76)
at org.directwebremoting.server.jetty.JettyContinuationSleeper.goToSleep(JettyContinuationSleeper.java:92)
at org.directwebremoting.dwrp.BasePollHandler.handle(BasePollHandler.java:234)
at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:120)
at org.directwebremoting.spring.DwrController.handleRequestInternal(DwrController.java:232)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1329)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1300)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:445)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:534)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1038)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:374)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:972)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:363)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:931)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:992)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:619)
项目主要配置文件如下: dwr的配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.directwebremoting.org/schema/spring-dwr
http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">
<!-- <dwr:annotation-config />
<tx:annotation-driven />
<dwr:configuration />
<dwr:annotation-config />
<dwr:url-mapping />
<dwr:controller id="dwrController" debug="true" />-->
<!-- <context:component-scan base-package="com.vancl.callcenter.module.monitor.agent" />-->
<dwr:annotation-scan scanRemoteProxy="true" base-package="com.vancl.callcenter.module.agentmonitor.dwr" />
<dwr:url-mapping />
<dwr:controller id="dwrController" debug="true" >
<dwr:config-param name="activeReverseAjaxEnabled" value="true" />
</dwr:controller>
<!-- <bean name="/hello" class="com.vancl.callcenter.module.monitor.agent.controller.HelloController"/>-->
<bean id="pullTaskStatusUtils" name="pullTaskStatusUtils" class="com.vancl.callcenter.module.agentmonitor.dwr.PullTaskStatusUtils">
<dwr:remote javascript="pullTaskStatusUtils">
<dwr:include method="show" />
</dwr:remote>
</bean>
<bean id="peopleTable" name="peopleTable" class="com.vancl.callcenter.module.sessionscript.dwr.PeopleTable">
<dwr:remote javascript="peopleTable">
</dwr:remote>
</bean>
<bean id="agentMonitor" name="agentMonitor" class="com.vancl.callcenter.module.agentmonitor.job.AgentMonitorJob">
<dwr:remote javascript="agentMonitor">
</dwr:remote>
</bean>
</beans>
web.xml 文件:
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:controller-servlet.xml,
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>*.shtm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
jsp页面: <script type='text/javascript' src='<%=path%>/dwr/engine.js'></script>
<script type='text/javascript'
src='<%=path%>/dwr/interface/pullTaskStatusUtils.js'></script>
<script type='text/javascript'
src='<%=path%>/dwr/interface/agentMonitor.js'></script>
<script type='text/javascript' src='<%=path%>/dwr/util.js'></script>
<SCRIPT language="javascript" src="<%=path%>/js/jquery-1.7.1.min.js"></SCRIPT>
window.onload=function()
{
dwr.engine.setActiveReverseAjax(true); // Initiate reverse ajax polling
//dwr.engine.setErrorHandler(errorHandler); // Called when a call and all retry attempts fail
//dwr.engine.setPollStatusHandler(updatePollStatus); // Optional function to call when the reverse ajax status changes (e.g. online to offline)
//updatePollStatus(true); // Optional - We are online right now! Until DWR determines we are not!
dwr.engine.setNotifyServerOnPageUnload(true); // Optional - When the page is unloaded, remove this ScriptSession.
//Tabs.init('tabList', 'tabContents'); // Initialize the tabs for this display
agentMonitor.task(); // Make a call to the server to begin updating the table!
//addAttributeToScriptSession(); // Make a remote call to the server to add an attribute onto the ScriptSession which will be used in determining what pages receive updates!
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货