Websocket on Tomcat 7.0.39 on openshift - java

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/

Related

How to access a localhost server from one computer to another on the same network

I have a spring boot application (Spring Web) which has a tomcat server embedded into it (maven dependency). The application is a server and consists of several HTTP routes. This application is on my laptop. I would like to execute the application on my laptop, and be able to RESTful calls (e.g. GET, POST etc) to the server. How can I make requests to the server from my computer?
I've checked out several tutorials and they tend to use XAMP or another similar application so not sure on how to go about this. Thank you.
Once your war is deployed on your server, you can send any REST call to it using curl, a browser, or my personal favorite for testing is Postman as it circumvents cross-domain issues.
To make the REST call simply use the IP address of the server instead of localhost. You can get the IP address of the machine using ifconfig or whatsmyip.org
http://<IP address>/...

Websockets not working properly on tomcat8 server

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?

Running Tomcat service on same port as IIS Service

I'm trying to set up three services to run on the same port (port 80). Two of the services are hosted on IIS thus enabling bindings to use the same port. One of the three services is however hosted on a Tomcat server as it is a Java Servlet. How can i set this up so that all can be accessed through port 80?
I've tried using URL Rewrite in the IIS to forward the request to port 8080 where the Tomcat service is active but it doesn't work with other services being active on port 80.
Any other ideas?
EDIT
I have no support for URL Rewrite not working for this purpose other than my own attempts. If anyone have used it and knows it should work, please shout out as it would be an optimal solution with minimal complexity to the system!

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.

JBoss Binding IP addresses

I need some help from someone who understands JBoss Hostname Binding. I think the solution is easy, although it's complicated to explain.
I am deploying an application using JBoss (v4.2) and am having troubles configuring the application.
This application has two parts, a web site on port 8080 and web services on port 8080 using SOAP APIs.
My server sits behind a firewall, and has an alias, let's say it's called orange.mycompany.com
My problem is that I cannot get the console to connect to the web services. The website works, but I see an connection refused error connecting to the web services.
[xfire.transport.http.HttpChannel]
java.net.ConnectException: Connection
refused
There are 2 things I can control, the bind IP on Tomcat, and the URL of the web services.
If I start JBoss, and bind to the local IP address:
./run.sh -b 10.1.2.3
And I set the URL of the web services to be that same IP
url=http://10.1.2.3:8080/services
I can see the website on port 8080 from outside the firewall, but the console cannot connect to webservices.
From the server, orange, itself I cannot see the website by calling http://localhost:8080/ or http://10.1.2.3:8080 or orange.mycompany.com:8080
However, if I start JBoss and bind to 127.0.0.1:
./run.sh -b 127.0.0.1
And I set the URL of the web services to localhost
url=http://localhost:8080/services
Now I can't see the website at all from outside the firewall.
But from the server itself, I can see the website browsing http://localhost:8080 and the I can successfully connect to the web services. That's great, but I need the website to be accessible from outside.
Can anyone suggest any combination of settings that will let me browse the website and also let the console call webservices on localhost?
Never mind.
Start JBoss binding to all IP's works.
./run.sh -b 0.0.0.0
Aren't your running JIRA standalone, right?
I always run tomcat and jboss behind a apache with mod_jk. This still hide ports, what sounds great for newbies users.
Your server is behind a NAT?
Sometimes I use ProxyPass or RewriteRules (mod_rewrite) to provide external access, thru reverse proxy.

Categories