Remote debugging tomcat with OpenShift - eclipse

I am using openshift for my tomcat webapp. I am able to run the app but unable to debug it. As openshift starts tomcat in debug mode, I was expecting I'll be able to debug.
Host:
$OPENSHIFT_JBOSSEWS_IP
Value of this is 127.5.20.129 for me which I got from command:
rhc port-forward -a {appname}
Port:
$OPENSHIFT_JBOSSEWS_HTTP_PORT
Value is 8080 for me.
I tried above host/port. I tried port 8000 too but nothing works. I am unable to connect from eclipse remote debugger each time.
Please help.

You should read through the Developer Portal's pages on Port Forwarding (https://developers.openshift.com/en/managing-port-forwarding.html) to make sure that you are using it correctly. You will want to connect to your local loopback address: 127.0.0.1 along with the correct forwarded port once you have run the port-forwarding command.

Related

The Python http server not working in local network

I´ve tried to start the python server with the following command python -m http.server and it says serving... so it should be working. I have this in a VM Linux maschine and the network adapter is set to bridged. When I access the localhost on port 8000 on the linux maschine the server is running on I can get access to the site and all the folders which the server serves but the problem is that I can´t access the site on any other VM nor the host maschine via the IP adress 192.168.2.206:8000 . The site is simply not loading. Can someone tell me whats wrong? I´ve also checked the firewall settings and allowed it for chrome. But this is not working as well.

Docker container, running PostgreSQL not allowing php's pg_connect from another container

I have the following architecture:
A network with 3 containers:
container_db, running PostgreSQL
container_pg_admin, running a simple pgAdmin environment
container_php_dev, running the whole environment, needed for the application to function properly (nginx, php, angular for the frontend, etc.)
When I try to pg_connect() from container_php_dev to container_db the connection gets refused. This is the actual error message I get: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: No route to host↵ Is the server running on host "container_db" (172.18.0.4) and accepting↵ TCP/IP connections on port 5432?.
However, when I try to connect to container_db from container_pg_admin I face no problem achieving this (host is container_db and port is 5432). Even if I map port 5432 of container_db to 5555 on host, I'm able to connect to 127.0.0.1:5555 from DBeaver or other DB Manager (TeamSQL).
All containers were restarted a few times as well as docker itself. And as this is my development machine, the host PC was restarted as well.
What might be the problem, how to diagnose and possibly solve? Have any of you experienced such strange docker behaviour?
Try running the container_db in the hosted network using flag --network host

Connecting Xdebug with NetBeans and Vagrant

I have spent quite a bit of time on this with no success. I am trying to connect my Xdebug through NetBeans to my Vagrant server.
The IP address of the Vagrant box is 192.168.33.10.
When NetBeans opens the debugging connection it says that it's looking at 192.168.33.1.
My php.ini settings are as follows
zend_extension=/usr/lib/php/20151012/xdebug.so
xdebug.profiler_enable=1
xdebug.profiler_output_name="cachegrind.out.%t.%p"
xdebug.collect_params=4
xdebug.collect_return=1
xdebug.remote_enable=1
xdebug.remote_log = /tmp/xdebug.log
xdebug.remote_port = 9000
xdebug.remote_host=192.168.33.1
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=0
xdebug.idekey="vagrant"
xdebug.remote_mode=req
;xdebug.remote_connect_back=1
In NetBeans my project URL is set to http://192.168.33.1:9000
debugger port is 9000 and Session ID is vagrant.
I know that NetBeans also looks at IP address 10.0.2.2 and I can't get this going either. When I run the debugger NetBeans just says that it's waiting for connection and my log stats that the connection has timed out.
I have also tried it with remote_connect_back=1 and to no avail.
Thank LazyOne for your feedback much appreciated
What I had to do to get this going was to open the ports 9000 on my windows machine and port 9000 on my server. I then login to my ssh server connecting to 127.0.0.1:2222 as specified by the vagrant bootup messages. Then set up a ssh tunnel to connect to port 9000. I did this using putty

eclipse debug can not connect to VM

Eclipse remote debug: can not connect to VM.
After starting tomcat,
telnet localhost 8787
works.
Then in eclipse, I tried to enable remote debug, got error: can not connect to VM.
telnet localhost 8787
will not work anymore.
What is the problem? It suddenly stopped working without any reason.
Thanks.

Trying to connect to a remote server using Eclipse

I have an Ubuntu server running Tomcat, and I want to connect my Eclipse EE to it so I can work with JSP.
I have no problem connecting to a similar Tomcat service when it's installed on my machine (not a server), but whenever I try to connect to the remote server I don't seem to have the option of choosing a Tomcat service.
Is there some guide you can recommend (I didn't find one), or is there something I did wrong?
The "remote" Tomcat (or more generally the app server) must be configured to permit such connection.
Did you start the remote server with these parameters:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Alternatively you can add the word jpda at the end of the startup.sh (or .bat) script just when calling the catalina.sh script.
Everything is documented on the Apache Tomcat Wiki.
After enabling those options, you have also another task to do: enabling the network connection to the configured port (8000 in the above options). It depends which firewall is installed on the server but usually it is iptables.
Example of iptables command to enable connection to port 8000:
sudo iptables -A INPUT -p tcp --dport 8000 -j ACCEPT
If your server have a GUI installed, one easiest way is to use the "ufw" – short for 'uncomplicated firewall' as explained in this site which is just a graphical way to configure the iptables.
One way to test the connectivity to the server (if the port is open) is to use telnet from your computer like this:
telnet your.distant.host 8000
and if the command opens, the port is accessible, if the telnet command times out, the port is closed.