Request Connection refused in two web apps in a server - java

I deploy two web apps in the same jetty in a server, AppA and AppB.
AnyOne in the WWW can access the two apps by the Domain mapped to the IP address of the server www.name.com/appA and www.name.com/appB.
The port of jetty is 8080.
The reason why we can access the app by www.name.com.appA in the port 80 is that I have mapped the outer Internet port 80 to the port 8080 in the inner server.
I need to access the data of the appA in the appB, just in a HTTP request like www.name.com/appA/requestXXX, but it fails with
org.apache.http.conn.HttpHostConnectException: Connect to name.com:80
[name.com/xx.xx.xxx.xxx] failed: Connection refused.

Related

can't connect to mqtt broker via ssl

I have a raspberry running a mqtt broker and a java backend. I can't establish a connection from backend to broker since I've implemented ssl. I can connect the backend to the broker on raspberry from my IDE running on my MacBook like:
client = new MqttAsyncClient(
"ssl://my-domain.com:1883", "backend");
if the backend is on the raspberry I tried:
client = new MqttAsyncClient(
"ssl://localhost:1883", "backend");
client = new MqttAsyncClient(
"ssl://127.0.0.1:1883", "backend");
No success. I´ve never used a ssl connection in this context. did I oversee something?
Error:
Exception in thread "main" No connection to client (32104)
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31)
at org.eclipse.paho.client.mqttv3.internal.ClientComms.sendNoWait(ClientComms.java:143)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.subscribe(MqttAsyncClient.java:721)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.subscribe(MqttAsyncClient.java:681)
at com.cdh.Service.mqttManager.subscribe(mqttManager.java:243)
at com.cdh.main.main(main.java:14)
EDIT:
I changed the port to 8883. It works if I run the backend on an other device but not if the broker and the backend are on the raspberry. I also tried to use the domain name from my cert.
The hostname you use to connect needs to match the CN or SAN entries in the certificate presented by the broker or else it will fail validation.
Unless you included 127.0.0.1 or localhost in the certificate the the client will reject the connection because the certificate doesn't validate for that address.
p.s. you should probably use a different port for MQTT of TLS rather than 1883 as that is the standard port for MQTT without TLS.

How to make a HTTPS request via TOR?

I use SilverTunnel NG Netlib Java-library for connecting to TOR from Java.
HTTP connection via TOR to port 80 and a direct HTTPS connection to port 443 connection works fine.
But, when I'm trying to establish a HTTPS connection via TOR to 443 port,
I get answer from server
400 The plain HTTP request was sent to HTTPS port.
How do I fix this?

Unable to connect to Tomcat server with URL

I can connect to my tomcat7 server using IP address but when I replace IP Address with my URL, I'm unable to connect to the host.
Error Message displayed:
This web page is not available
ERR_CONNECTION_REFUSED
The website may be down or your network may not be properly configured.
Try add pair host_ip host_name to host's file in your compruter.

Access Oracle Http server(OHS) in a LAN

I have configured OHS server infront of Weblogic to forward all request from OHS to WL server and it's working fine in local machine(where both WL and OHS are installed) and I could access the application deployed on WebLogic using OHS port.
http://localhost:OHS_port/MyApp/,
http://host_IP:OHS_port/MyApp/ and
http://127.0.0.1:OHS_port/MyApp/
all these url's working fine in the same machine where OHS and weblogic servers are deployed.
But when I try to access the same in LAN using OHS server port ,I am unable to access the application(http://host_IP:OHS_port/MyApp/), but same is accessible using weblogic port(http://host_IP:WL_port/MyApp/).
httpd.conf -
Listen 7777
ServerName 10.0.0.10:7777
(Rest of details in this files are default values)
mod_wl_ohs.conf -
<IfModule weblogic_module>
<Location /MyApp>
WLSRequest On
WebLogicHost 10.0.0.10
WeblogicPort 7001
</Location>
</IfModule>
Any idea why I am unable to access with OHS port? Is this something to do with firewall? If firewall issue, how I am able to access with weblogic port and not with OHS(I tried exchanging OHS and WL port and still the behavious is same(works with new weblogic port but not with OHS port)).
Thanks
Your ServerName value should be the host name that you want OHS to respond on or the LAN IP address.
For instance, if the IP address of the machine is 10.1.1.10 and the hostname is myohs.mydomain.com, use the following:
ServerName myohs.mydomain.com
Also, be sure DNS is mapping myohs.mydomain.com to 10.1.1.10.

java.net.SocketException: Permission denied openshift

I'm trying to make several socket connection in an app. deployed on oTomcat OpenShift and I get this exception:
java.net.SocketException: Permission denied
My Account is free it's possible that with a payment Account openshift let me make binding to several port (open several sockect).
For plain WebSockets ws:// you can port 8000 and for secured connections wss:// port 8443. This blog goes into more detail https://www.openshift.com/blogs/paas-websockets and should point you in the right direction.

Categories

Resources