WebSockets on DIY cartridge on OpenShift - websocket

I'm trying to build DIY application on OpenShift that implements WebSockets. I started with this example:
https://www.openshift.com/blogs/how-to-build-java-websocket-applications-using-the-jsr-356-api
If I run it locally, it works perfectly. When I upload the code to a DIY OpenShift cartridge and compile it, I get an error. I modified the code so that the Server connects to $OPENSHIFT_DIY_IP on port 8000, but when the code reaches the line server.start(); it crashes with the following error.
What am I doing wrong? I tried other ports (17500 and on) without any luck.
Error:
Binding server to 127.7.177.1:8000
Jun 04, 2014 10:28:02 AM org.glassfish.tyrus.server.ServerContainerFactory create
INFO: Provider class loaded: org.glassfish.tyrus.container.grizzly.GrizzlyEngine
java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:444)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bindToChannelAndAddress(TCPNIOBindingHandler.java:131)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:87)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:64)
at org.glassfish.grizzly.AbstractBindingHandler.bind(AbstractBindingHandler.java:140)
at org.glassfish.grizzly.AbstractBindingHandler.bind(AbstractBindingHandler.java:159)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:470)
at org.glassfish.grizzly.http.server.NetworkListener.start(NetworkListener.java:658)
at org.glassfish.grizzly.http.server.HttpServer.start(HttpServer.java:264)
at org.glassfish.tyrus.container.grizzly.GrizzlyEngine$1.start(GrizzlyEngine.java:88)
at org.glassfish.tyrus.server.TyrusServerContainer.start(TyrusServerContainer.java:119)
at org.glassfish.tyrus.server.Server.start(Server.java:122)
at org.neo.wordgame.server.WebSocketServer.runServer(WebSocketServer.java:23)
at org.neo.wordgame.server.WebSocketServer.main(WebSocketServer.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:744)
Please press a key to stop the server.Jun 04, 2014 10:28:04 AM org.glassfish.tyrus.server.Server stop
INFO: Websocket Server stopped.

Your application needs to listen on port 8080 on your $OPENSHIFT_DIY_IP, but you need to connect to it from the outside at http://app-domain.rhcloud.com:8000 or http://app-domain.rhcloud.com:8443 (ssl). Binding to port 8000 on your $OPENSHIFT_DIY_IP won't work.

It is just as developercorey says. Latest news about WebSockets on OpenShift I could find is this blog post, clearly saying that you have to access 8000/8443 from outside.
As a live example, I've deployed application using WebSockets into OpenShift. If you access it using http://vinbudin-openshift.anthavio.net/ui
Although application still works, because it can degrade to long-polling silently,
when you look into Chrome Developer Tool Network Tab, you can see rejected WebSocket upgrade request
Request URL:ws://vinbudin-openshift.anthavio.net/ui/PUSH/?v-uiId=0&v-csrfToken=bcd0c9a6-2a6f-4ddb-8332-7929e4337b2d&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.5.vaadin4-jquery&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true
Request Method:GET
Status Code:501 Not Implemented
But using url with port 8000 http://vinbudin-openshift.anthavio.net:8000/ui yields better result
Request URL:ws://vinbudin-openshift.anthavio.net:8000/ui/PUSH/?v-uiId=0&v-csrfToken=bcd0c9a6-2a6f-4ddb-8332-7929e4337b2d&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.5.vaadin4-jquery&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true
Request Method:GET
Status Code:101 Switching Protocols

Related

Jmeter - Non HTTP response code: org.apache.http.conn.HttpHostConnectException is observed on trying to record a script for 1 user

I am trying to record a login scenario for my application built using Blazor technology through Templates (File > Templates > Recording) for a single user.
I see that few of the initial sampler results are successful and then I see the below error in View Results Tree. Error is constant on trying many times.
Sampler Result
Thread Name:
Sample Start:2021-01-12 09:35:17 GMT
Load time:21037
Connect Time:21037
Latency:0
Size in bytes:2582
Sent bytes:0
Headers size in bytes:0
Body size in bytes:2582
Sample Count:1
Error Count:1
Data type ("text"|"bin"|""):text
Response code:Non HTTP response code: org.apache.http.conn.HttpHostConnectException
Response message:Non HTTP response message: Connect to push.services.mozilla.com:443 [push.services.mozilla.com/44.238.116.130] failed: Connection timed out: connect
HTTPSampleResult fields:
ContentType:
DataEncoding: null
Response Data:
org.apache.http.conn.HttpHostConnectException: Connect to push.services.mozilla.com:443 [push.services.mozilla.com/44.238.116.130] failed: Connection timed out: connect
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$JMeterDefaultHttpClientConnectionOperator.connect(HTTPHC4Impl.java:401)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:930)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:641)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1281)
at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:234)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.base/java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.base/java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.PlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:368)
at org.apache.jmeter.protocol.http.sampler.hc.LazyLayeredConnectionSocketFactory.connectSocket(LazyLayeredConnectionSocketFactory.java:91)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
... 14 more
In the logs, I see errror in
Line 2: 2021-01-12 09:34:16,562 ERROR f.configuration: DefaultObjectWrapper.incompatibleImprovements was set to the object returned by Configuration.getVersion(). That defeats the purpose of incompatibleImprovements, and makes upgrading FreeMarker a potentially breaking change. Also, this probably won't be allowed starting from 2.4.0. Instead, set incompatibleImprovements to the highest concrete version that's known to be compatible with your application.
Line 3: 2021-01-12 09:34:16,562 ERROR f.configuration: Configuration.incompatibleImprovements was set to the object returned by Configuration.getVersion(). That defeats the purpose of incompatibleImprovements, and makes upgrading FreeMarker a potentially breaking change. Also, this probably won't be allowed starting from 2.4.0. Instead, set incompatibleImprovements to the highest concrete version that's known to be compatible with your application.
Line 72: 2021-01-12 09:37:39,166 WARN o.a.j.p.h.p.Proxy: [53022] Problem with SSL certificate for url for 'incoming.telemetry.mozilla.org'? Ensure browser is set to accept the JMeter proxy cert: Software caused connection abort: recv failed
NOTE :
I have tried recording using the Non HTTP Script Recorder too - same issue.
I see this issue when application is launched on a test server with no internet connection.
I see this issue when the application is hosted locally on the same test server.
Also in UI - Page contents do not load and login page is displayed as a blank page with only the page title and page url as expected.
The application URL is of the format https://abcd.com:1234/login
I have updated the port number in JMeter and Firefox browser as 8888
Root CA certificate is added.
I see the same issue even after increasing timeout to 60000 in HTTP Request defaults
Looking into the push.services.mozilla.com hostname it appears that JMeter catches requests to Firefox Web Push notifications service (allowing websites to send notifications to you)
I don't think you should be recording these requests (unless you're explicitly testing them) so you should add this push.services.mozilla.com to "URL Patterns to Exclude" section of the HTTP(S) Test Script Recorder
More information: Excluding Domains from the Load Test
You should repeat the exercise for all the requests to/from 3rd-party domains if any so your test scope would be limited to your system under test only

Laravel WebSockets - deployment - fails to connect the websocket

I am trying to deploy my laravel project with websockets built on Beyond Code's package.
My server is on AWS and i'm using WHM.
on the cPanel's terminal i'm running the line php artisan websockets:serve
and i get the result Starting the WebSocket server on port 6001...
when i'm loading the page with the websocket's connection sometimes i get the error failed: Error during WebSocket handshake: Unexpected response code: 200
and sometimes i get the error failed: WebSocket is closed before the connection is established.
On AWS EC2's Security Groups i allowed the Custom TCP port 6001 and 6002
Any suggestions to fix it?
Maybe a good deployment tutorial for Laravel WebSockets?
I'm looking for answers all over the internet and i get nothing useful.

Javascript Adapter throwing java.net.SocketException: Connection reset

I am trying to make a https call to the backend server that gives a json data , i could get the by making https calls using browser but when make the same call using the javascript adapter i getting this output
I followed this IBM Knowledge Center to add the cert to the default mobilefirst keystore. I am not sure why i am getting this error?
[ERROR ] FWLSE0099E: An error occurred while invoking procedure [project kmf]login/HttpRequestFWLSE0100E: parameters: [project kmf]
Http request failed: java.net.SocketException: Connection reset
FWLSE0101E: Caused by: [project kmf]java.net.SocketException: Connection resetjava.lang.RuntimeException: Http request failed: java.net.SocketException: Connection reset
at com.worklight.adapters.http.HTTPConnectionManager.execute(HTTPConnectionManager.java:271)
at com.worklight.adapters.http.HttpClientContext.doExecute(HttpClientContext.java:201)
at com.worklight.adapters.http.HttpClientContext.execute(HttpClientContext.java:185
From the comments, by Vivin:
Connection reset means , the backend server has reset the connection. You should consult your network team/ backend team and verify why this occuring. Firewalls / network issues / backend server connection issues are all possibilities. MobileFirst server is only reporting the issue as it found

Wrong protocol or connection state for the requested transaction or request error on Windows Server 2012

We are migrate a old vb application from windows server 2000 to 2012, after the installation, the application give following errors when running:
<40006> Wrong protocol or connection state for the requested
transaction or request (Winsock-->[WSUtils]frmClient.gfSendData
LN1-->[WSUtils]Client.SendData LN1-->[IIMMC]Client.msSendData
LN0-->[IIMMC]Client.LockSchedule LN0-->[IIMMC]frmMain.cmdLock_Click
LN0)
We dont have any source code for this application. How could I explore to find the reason caused the error? Thanks.

Single RMI clients marshalling exception

I am facing a very strange problem.
I am using my application with RMI for 8 month in production but since a new (big) update I dont know what is wrong.
It is a server where 3 clients connect.
And when I am using only client with a certain method I can not find anything wrong especially because all other clients work perfectly.
Is there maybe with RMI any local "cache" which should be deleted otherwise I can't tell.
Here is the output of the client's console:
C:\Users\Claudia\Desktop>java -jar CLIENT_erp_auer_client_v0_8ASASADSD.jar
java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.net.SocketException: Software caused connection abort: socket write error
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Sou
rce)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source)
at $Proxy7.update(Unknown Source)
at client.entity_types.LieferscheinpositionService.aendereLieferscheinposition(
LieferscheinpositionService.java:60)
at client.lieferscheinverwaltung.TreeTableNEULieferschein.addLieferscheinpositi
onen(TreeTableNEULieferschein.java:912)
at client.lieferscheinverwaltung.TreeTableNEULieferschein.<init>(TreeTableNEULi
eferschein.java:204)
at client.lieferscheinverwaltung.LieferscheinErstellung.getTreeTableNeuLiefersc
hein(LieferscheinErstellung.java:916)
at client.lieferscheinverwaltung.LieferscheinErstellung.<init>(LieferscheinErst
ellung.java:773)
at client.lieferscheinverwaltung.LieferscheinManagement.openLieferschein(Liefer
scheinManagement.java:1055)
at client.lieferscheinverwaltung.LieferscheinManagement$9.mouseClicked(Liefersc
Thank you.

Resources