OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: camel-atmosphere-websocket + TomEE


It works but there is one annoying thing though - the exception below is logged when client disconnects:

14:38:11.133 [http-nio-8080-exec-6] ERROR o.a.container.JSR356Endpoint - 
java.io.IOException: java.io.IOException: An established connection was aborted by the software in your host machine
	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:315)
	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:258)
	at org.apache.tomcat.websocket.WsSession.sendCloseMessage(WsSession.java:592)
	at org.apache.tomcat.websocket.WsSession.onClose(WsSession.java:512)
	at org.apache.tomcat.websocket.WsFrameBase.processDataControl(WsFrameBase.java:347)
	at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:289)
	at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:133)
	at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:82)
	at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171)
	at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151)
	at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148)
	at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: An established connection was aborted by the software in your host machine
	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:65)
	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
	at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
	at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
	at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:157)
	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1261)
	at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:670)
	at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:607)
	at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:597)
	at org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer.doWrite(WsRemoteEndpointImplServer.java:95)
	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.writeMessagePart(WsRemoteEndpointImplBase.java:494)
	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:309)
	... 19 common frames omitted

There is some solution for preventing it (https://stackoverflow.com/questions/25662371/websocket-error-by-closing-a-page-via-browser-an-established-connection-was-ab) but I don't know where to stick the ' @OnError annotation.  Any ideas?

Dmitry



-----Original Message-----
From: Shultz, Dmitry [mailto:Dmitry_Shultz@xxxxxxxxxxx] 
Sent: Tuesday, May 22, 2018 11:17 AM
To: users@xxxxxxxxxxxxxxxx
Subject: RE: camel-atmosphere-websocket + TomEE

Thanks a lot Zoran, mapping org.apache.camel.component.atmosphere.websocket.CamelWebSocketServlet works!


Cheers,
Dmitry


-----Original Message-----
From: Zoran Regvart [mailto:zoran@xxxxxxxxxxx]
Sent: Friday, May 18, 2018 6:30 AM
To: users@xxxxxxxxxxxxxxxx
Subject: Re: camel-atmosphere-websocket + TomEE

Hi Dmitry,
I think you need to use
org.apache.camel.component.atmosphere.websocket.CamelWebSocketServlet
instead of or in addition to the default org.apache.camel.component.servlet.CamelHttpTransportServlet.

From what I can see CamelWebSocketServlet extends from CamelHttpTransportServlet so just replacing it should help in your case.

zoran

On Thu, May 17, 2018 at 11:22 PM, Shultz, Dmitry <Dmitry_Shultz@xxxxxxxxxxx> wrote:
> Hi All,
>
> I'm running CDI + JSF + Deltaspike + Camel web app in TomEE. My web.xml contains following config for the servlets:
>
>    <servlet>
>         <servlet-name>Faces Servlet</servlet-name>
>         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>Faces Servlet</servlet-name>
>         <url-pattern>*.xhtml</url-pattern>
>     </servlet-mapping>
>     <welcome-file-list>
>         <welcome-file>dashboard.xhtml</welcome-file>
>     </welcome-file-list>
>
>     <servlet>
>         <display-name>Camel Http Transport Servlet</display-name>
>         <servlet-name>CamelServlet</servlet-name>
>         <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>
>     <!-- define that url path for the Camel Servlet to use -->
>     <servlet-mapping>
>         <servlet-name>CamelServlet</servlet-name>
>         <url-pattern>/rest/*</url-pattern>
>     </servlet-mapping>
>
> It's all works good except of camel-atmosphere-websocket, when I create route:
>
> from("atmosphere-websocket:///mypath");
>
> from("direct:ws").to("atmosphere-websocket:///mypath?sendToAll=true");
>
> HTTP Client is not able to connect to the WS, getting:
>
> WebSocket connection to 'ws://localhost:8080/my-app/rest/mypath' 
> failed: Error during WebSocket handshake: Unexpected response code: 
> 404
>
> Is there anything I'm missing?
>
> Actually, I'm not sure if camel-atmosphere-websocket actually creates 
> the server endpoint (the same as this one for example:
> https://github.com/WASdev/sample.microprofile.meetingapp/blob/master/s
> rc/main/java/net/wasdev/samples/microProfile/meetings/MeetingNotifier.
> java)
>
> Cheers,
> Dmitry
>
>



--
Zoran Regvart