Hello,
first things first:
SmartGWT - Version (Developer Console): SmartClient Version: v10.0p_2015-10-03/EVAL Deployment (expires 2015.12.02_09.33.55) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)
Browser Version: Google Chrome - 45.0.2454.101 m
Now to the topic:
I've created a data source that communicates with a backend system via socket connection.
It is possible that the data of the backend system is changed without any action from the SmartGWT system.
When this happens the backend system fires an event on which I'm listening in my DMI handler and then try to execute the following method:
This approach is working up to the point where i try to instantiate an ISCMessageDispatcher, then the following output appears:
However, when I start the mentioned method from a client call like "fetch", the the sendToClients() method works without any problems. I think that the ISCMessageDispatcher is missing some kind of context, but I can't provide any, because the communication to the clients is initiated by an event from the backend system.
What is the approach of getting this done?
Thank you very much.
first things first:
SmartGWT - Version (Developer Console): SmartClient Version: v10.0p_2015-10-03/EVAL Deployment (expires 2015.12.02_09.33.55) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)
Browser Version: Google Chrome - 45.0.2454.101 m
Now to the topic:
I've created a data source that communicates with a backend system via socket connection.
It is possible that the data of the backend system is changed without any action from the SmartGWT system.
When this happens the backend system fires an event on which I'm listening in my DMI handler and then try to execute the following method:
Code:
private void sendToClients() { log.info("JOBHANDLER - sendToClients"); final DSResponse resp = new DSResponse(-1); ISCMessageDispatcher dispatcher; try { RequestContext ctx = new RequestContext(); dispatcher = ISCMessageDispatcher.instance(ctx); } catch (Exception e) { log.info("JOBHANDLER - Could not create dispatcher!"); e.printStackTrace(); return; } log.info("JOBHANDLER - sendToClients - ISCMessageDispatcher instantiated"); final Map data = new HashMap(); data.put("invalidateCache", resp.getInvalidateCache()); data.put("operationType", DSOperationType.UPDATE); data.put("records", resp.getRecords()); try { dispatcher.send(new ISCMessage("gridUpdates", data)); log.info("JOBHANDLER - sendToClients - message sent"); } catch (Exception e) { log.error("JOBHANDLER - Could not send update message"); e.printStackTrace(); } }
Code:
=== 2015-10-09 09:50:59,971 [2-43] INFO Compression - /__SmartGwtTest.html: 0 -> 20 bytes === 2015-10-09 09:50:59,972 [2-43] ERROR Compression - Caught exception in doFilter() - for URI: /__SmartGwtTest.html java.lang.IllegalStateException: NO CONTENT at org.eclipse.jetty.http.HttpGenerator.addContent(HttpGenerator.java:176) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:155) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:107) at java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:154) at com.isomorphic.compression.ServletCompression.compressAndSend(ServletCompression.java:159) at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:387) at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:83) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) 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:745) === 2015-10-09 09:51:00,030 [-114] INFO Compression - /__smartgwttest/sc/modules/ISC_Containers.js: 151637 -> 35828 bytes === 2015-10-09 09:51:00,047 [-117] INFO Compression - /__smartgwttest/sc/modules/ISC_Forms.js: 856109 -> 207074 bytes === 2015-10-09 09:51:00,048 [-114] INFO Compression - /__smartgwttest/sc/modules/ISC_RichTextEditor.js: 61694 -> 16214 bytes === 2015-10-09 09:51:00,058 [2-46] INFO Compression - /__smartgwttest/sc/modules/ISC_Core.js: 1026021 -> 270600 bytes === 2015-10-09 09:51:00,088 [-114] INFO Compression - /__smartgwttest/sc/modules/ISC_Calendar.js: 256953 -> 62142 bytes === 2015-10-09 09:51:00,102 [2-43] INFO Compression - /__smartgwttest/sc/modules/ISC_Foundation.js: 311302 -> 72781 bytes === 2015-10-09 09:51:00,151 [-117] INFO Compression - /__smartgwttest/sc/modules/ISC_RealtimeMessaging.js: 13531 -> 4693 bytes === 2015-10-09 09:51:00,189 [-117] INFO Compression - /__smartgwttest/sc/modules/ISC_Charts.js: 296320 -> 80264 bytes === 2015-10-09 09:51:00,197 [-114] INFO Compression - /__smartgwttest/sc/modules/ISC_DataBinding.js: 867082 -> 209183 bytes === 2015-10-09 09:51:00,213 [2-46] INFO Compression - /__smartgwttest/sc/modules/ISC_DSBrowser.js: 15389 -> 4385 bytes === 2015-10-09 09:51:00,218 [2-43] INFO Compression - /__smartgwttest/sc/modules/ISC_Drawing.js: 304376 -> 77118 bytes === 2015-10-09 09:51:00,232 [-117] INFO Compression - /__smartgwttest/sc/modules/ISC_FileLoader.js: 40311 -> 11806 bytes === 2015-10-09 09:51:00,240 [2-46] INFO Compression - /__smartgwttest/sc/modules/ISC_History.js: 31948 -> 9548 bytes === 2015-10-09 09:51:00,249 [-117] INFO Compression - /__smartgwttest/sc/modules/ISC_PluginBridges.js: 16719 -> 5193 bytes === 2015-10-09 09:51:00,267 [2-43] INFO Compression - /__smartgwttest/sc/modules/ISC_SQLBrowser.js: 16842 -> 4985 bytes === 2015-10-09 09:51:00,270 [-117] INFO Compression - /__smartgwttest/sc/modules/ISC_Workflow.js: 20594 -> 5322 bytes === 2015-10-09 09:51:00,273 [2-46] INFO Compression - /__smartgwttest/sc/modules/ISC_Tools.js: 94558 -> 24382 bytes === 2015-10-09 09:51:00,287 [-117] INFO RequestContext - URL: '/__smartgwttest/sc/DataSourceLoader', User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36': Safari with Accept-Encoding header === 2015-10-09 09:51:00,289 [2-43] INFO Compression - /__smartgwttest/loadScriptTagFiles.js: 0 -> 36 bytes === 2015-10-09 09:51:00,289 [2-43] ERROR Compression - Caught exception in doFilter() - for URI: /__smartgwttest/loadScriptTagFiles.js java.lang.IllegalStateException: NO CONTENT at org.eclipse.jetty.http.HttpGenerator.addContent(HttpGenerator.java:176) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:155) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:107) at java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:154) at com.isomorphic.compression.ServletCompression.compressAndSend(ServletCompression.java:159) at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:387) at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:83) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) 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:745) === 2015-10-09 09:51:00,290 [-114] INFO Compression - /__smartgwttest/__smartgwttest.nocache.js: 2478 -> 1222 bytes === 2015-10-09 09:51:00,296 [-117] INFO Compression - /__smartgwttest/sc/DataSourceLoader: 8724 -> 2208 bytes === 2015-10-09 09:51:00,407 [-116] INFO Compression - /__smartgwttest/sc/modules/ISC_Grids.js: 1024087 -> 259839 bytes === 2015-10-09 09:51:01,086 [-114] INFO Compression - /__smartgwttest/sc/initsc.js: 47 -> 72 bytes === 2015-10-09 09:51:01,096 [-117] INFO Download - done streaming: C:/test/__SmartGwtTest/war/__smartgwttest/sc/skins/Enterprise/load_skin.js === 2015-10-09 09:51:01,099 [-117] INFO Compression - /__smartgwttest/sc/skins/Enterprise/load_skin.js: 71030 -> 11498 bytes === 2015-10-09 09:51:01,111 [2-46] INFO RequestContext - URL: '/__smartgwttest/sc/DataSourceLoader', User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36': Safari with Accept-Encoding header === 2015-10-09 09:51:01,118 [2-46] INFO Compression - /__smartgwttest/sc/DataSourceLoader: 8724 -> 2208 bytes === 2015-10-09 09:51:01,510 [-114] INFO RequestContext - URL: '/__smartgwttest/sc/DataSourceLoader', User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36': Safari with Accept-Encoding header === 2015-10-09 09:51:01,515 [-114] INFO Compression - /__smartgwttest/sc/DataSourceLoader: 8724 -> 2208 bytes GET /recompile/__smartgwttest Job de.test.__SmartGwtTest_1_1 starting job: de.test.__SmartGwtTest_1_1 binding: user.agent=safari skipped compile because no input files have changed 0,084s total -- Compile completed === 2015-10-09 09:51:02,878 [-114] INFO RequestContext - URL: '/__smartgwttest/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36': Safari with Accept-Encoding header === 2015-10-09 09:51:02,885 [-114] INFO IDACall - Performing 1 operation(s) GET /sourcemaps/__smartgwttest/697C5B09F564E811DCE67C293E788228_sourcemap.json sent source map for module '__smartgwttest' in 96 ms === 2015-10-09 09:51:13,206 [-114] INFO JobHandler - Server connection initialized === 2015-10-09 09:51:13,206 [-114] INFO JobHandler - JOB - Intercepted FETCH request === 2015-10-09 09:51:13,222 [-114] INFO StmJobDataSource - PushUpdateDataSource - FETCH === 2015-10-09 09:51:13,224 [-114] INFO DSResponse - [builtinApplication.job_fetch] DSResponse: List with 15 items === 2015-10-09 09:51:13,299 [-114] INFO Compression - /__smartgwttest/sc/IDACall: 25027 -> 3805 bytes === 2015-10-09 09:51:18,478 [ue-0] INFO JobHandler - JOBHANDLER - sendToClients === 2015-10-09 09:51:18,478 [ue-0] INFO JobHandler - JOBHANDLER - Could not create dispatcher! java.lang.ClassCastException: com.isomorphic.messaging.LocalMessageDispatcher cannot be cast to com.isomorphic.messaging.ISCMessageDispatcher at com.isomorphic.messaging.ISCMessageDispatcher.instance(ISCMessageDispatcher.java:101) at com.isomorphic.messaging.ISCMessageDispatcher.instance(ISCMessageDispatcher.java:79) at de.test.server.dmi.JobHandler.sendToClients(JobHandler.java:99) at de.test.server.dmi.JobHandler.access$0(JobHandler.java:92) at de.test.server.dmi.JobHandler$1.attributeChanged(JobHandler.java:57) at de.server.base.TestObject.notifyObjectChange(TestObject.java:275) at de.server.base.NotificationKey.run(TestObject.java:3913) at de.base.util.concurrent.NotificationDispatcher$2.run(NotificationDispatcher.java:147) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:714) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
What is the approach of getting this done?
Thank you very much.
Comment