Websockets not working properly on tomcat8 server - java

Below are the two scenarios that I am trying.
I have deployed application on server(tomcat8) using eclipse IDE. and then connecting the client with server using websocket protocol. It is working fine.
I have installed tomcat8 on a server machine, deployed the application and then connecting the client with server using websocket protocol. Then I am getting 404 not found error.
also If I run any jsp file on server using http protocol then it is working properly.
can anybody tell what I need to do to resolve this issue?

Related

Sending requests to spring boot service application hosted in remote Linux Server

I have deployed a stand alone spring boot jar file to a Redhat Linux server. The jar is running in localhost:8081 in the Linux server.
The Spring Boot application has some endpoints. For example localhost:8081/api/some-post-endpoint.
Usually, I would hit an endpoint in my local machine using Postman by selecting the HTTP method and putting localhost:8081/api/some-post-endpoint in the url bar of Postman.
I'm clueless on how I would hit and endpoint from the instance of application I deployed in Redhat Linux server.
For example, if my Redhat Server address is u12345.test.cloud.com, when I tried to put u12345.test.cloud.com/api/some-post-endpoint in Postman, it returned an error saying
Could not send request
Error: connect ECONNREFUSED
I am able to ping the Linux server and it succeeds.
It's just my first time to deploy an app to cloud and I saw something that says "Service Name" in the deployment options.
Is Service Name required to hit a remote endpoint?
What steps can I do to check if I can possibly hit the endpoint via postman?
I'd appreciate any comments.
Thank you.

How to run/deploy websocket in tomcat

I have created a websocket server using the tomcat libraries. I am using Eclipse and my websocket client is written in java using tyrus libraries.
But the way I am deploying the websocket server doesn't seem right.
Currently, I am doing Right Click>Run on Server.
It tries to open the socket in the browser using http and gets a 404.
But the web socket gets deployed anyways in this process, and clients can connect to it.
Is there a cleaner way, by which I can deploy a websocket on Tomcat server through Eclipse?

Proxy for Tomcat outgoing HTTP requests

I have a JavaEE web application deployed in an Apache Tomcat 7.0.6 under Windows 7 which comunicates with a remote web service to request some data. I would like to intercept the comunication between them with an HTTP proxy, like BurpSuite (http://www.portswigger.net/burp/), so I can see the HTTP messages sent and received by the JavaEE application deployed in Tomcat. Already tried to set my BurpSuite (listening on port 8090/TCP) as a proxy system in Windows 7 and specifying some options for JVM when runs Tomcat (-Dhttp.proxyHost=10.0.2.16 -Dhttp.proxyPort=8091 -Dhttps.proxyHost=10.0.2.16 -Dhttps.proxyPort=8091).
I've been looking for a way to do this but I didn't find anything usefull. Could you please give me hand?
Greetings and thanks in advance.

Websocket on Tomcat 7.0.39 on openshift

I've just successfully installed Apache Tomcat 7.0.39 on my openshift account (tomcat-ngoanhtuanthesis.rhcloud.com/). I know that tomcat 7.0.39 has supported Websocket. In my local computer, I can run my web socket aplication properly, but I cannot run it in the openshift server. However, my web service application can run very well. I've searched over the Internet for the whole week but I couldn't find any solution. Can anyone help me? Thank you in advance!
Note: here is my Web service:
tomcat-ngoanhtuanthesis.rhcloud.com/TrueTrafficServerAlpha2/
And here are some websocket examples integrated in Tomcat 7.0.39. These examples cannot run even though they are very simple.
http://tomcat-ngoanhtuanthesis.rhcloud.com/examples/websocket/
Did you read this? https://www.openshift.com/blogs/paas-websockets
WebSockects are currently under staging on openshift, and are available on alternative ports.
How to access Preview WebSockets Support?
You will need to connect to
specific ports, as the main routing layer is still Apache based and
does not support WebSockets.
So, for plain WebSockets ws:// you will use port 8000 and for secured
connections wss:// port 8443. Here's an example:
http://app-lovingwebsockets.rhcloud.com/ <= your current HTTP URL
http://app-lovingwebsockets.rhcloud.com:8000/ <= WebSockets enables HTTP URL
https://app-lovingwebsockets.rhcloud.com/ <= your current HTTPs URL
https://app-lovingwebsockets.rhcloud.com:8443/ <= WebSockets enables HTTPs URL
So, just open your samples here, and they will just work (hopefully):
https://tomcat-ngoanhtuanthesis.rhcloud.com:8443/examples/websocket/

Debugging an already deployed JAX-WS service in Eclipse

There is a Webservice written in Java (using jax-ws api's), already deployed on server. Suddenly, it has started giving wierd results, for some HTTP requests, that I could not reproduce on my local-box. Is it possible that I fire the HTTP request on the same server, and start debugging the code on eclipse installed on my local box.
Please help me with the steps for the same.
Thanks
On what application server are deployed your web service ?
You need to enable remote debug on your Tomcat, JBoss, Websphere, whatever application server, and just need to create a remote debug task in eclipse to connect on the right ip/port.
This is all you have to do.
To activate remote debugging for your application server, just add the following line to the JAVA_OPTS: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
For eclipse you can follow this link

Categories