Debug Port in containerized WebLogic server - java

I have a containerized WebLogic server which is running on my docker host mapped with three port: 5556, 6001, 7001. I have deployed my java product and everything is successful. I have also assaign a debug port on 8453 based on this article on WebLogic:
https://docs.oracle.com/en/cloud/paas/java-cloud/jscug/enable-jvm-debug-port.html#GUID-C83E051D-3A28-4FE7-8333-20F40A06DAEA
In Intellij IDE, I configured my debug port on localhost port 8453 in ‘Edit Configuration…’ . here everything seems extremly OK and good. But as I am going to debug connection gets failed.
"unable to open debugger port (localhost:8453): java.net.connectException "Connection refused: connect"
I am a little bit naive in WebLogic server. It might be because somehow given port not mapped causes this error. Please help me if anybody there had such experience before.

The environmental variable JAVA_OPTIONS is typically being set on startWeblogic.sh. With using a dockerized weblogic, the same variable needs to be set with the debug options and the address.
For example, you can set the variable on your Dockerfile.
The following will set the debug port for the Weblogic applications to 4000 :
ENV JAVA_OPTIONS $JAVA_OPTIONS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n
Also this port needs to be exposed.
For example on docker-compose.yml:
ports:
- 4000:4000
On IntelliJ IDEA, the handshake is succesful without using IP Address of the container.

Related

How to debug remote JVM exposed by ngrok tunnel

I have a java process on one of my machines listening on port 4502. I have created a tunnel using ngrok so that I can access the application on my development machine. The issue I'm facing is attaching a debugger to the remote JVM.
Here is the debug java configuration I'm using:
-agentlib:jdwp=transport=dt_socket,address=*:5005,server=y,suspend=n
Here is the ngrok configuration for the tunnel to the application:
ngrok http 4502
Here is the ngrok configuration for the tunnel to the JVM (I have also tried http protocol with no luck):
ngrok tcp 5005
ngrok outputs the following for the tcp tunnel:
Forwarding tcp://2.tcp.eu.ngrok.io:10928 -> 127.0.0.1:5005
Using IntelliJ, I configure the remote debugging like this:
Debugger mode: Attach to remote JVM
Host: tcp://2.tcp.eu.ngrok.io
Port: 10928
I get the following error when starting the debugger:
Error running 'Debug Author Desktop': Unable to open debugger port (tcp://2.tcp.eu.ngrok.io:10928): java.io.IOException "handshake failed - connection prematurally closed"
On the machine running the java process, I have made sure that the 5005 port is open before starting the process. On the machine using IntelliJ, I have made sure that the 10928 port is open. What must I do so that I can attach the debugger to the process running on my second machine? Any help would be appreciated.
I've found the solution. The issue was in the Remote Debugger configuration. When specifying the host, you must not include the protocol. Once I changed tcp://2.tcp.eu.ngrok.io to 2.tcp.eu.ngrok.io, it worked!

RabbitMQ is running still getting connection refused Connect Exception

I have installed rabbit MQ 3.8.3 on windows 10 and I can see it is running as windows services.
When I try to access http://localhost:15672/ it is unreachable.
I have enabled the rabbit MQ management plugin in sbin directory
rabbitmq-plugins enable rabbitmq_management
But still, http://localhost:15672/ is unreachable.
Getting the following error in java service :
org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
I have also run the command to see if anything is running on port 5672:
Command : netstat -ano | find "5672"
Response : TCP 0.0.0.0:25672 0.0.0.0:0 LISTENING 2900
How do I fix this?
The management UI can be accessed using a Web browser at http://{node-hostname}:15672/
The management plugin is included in the RabbitMQ distribution. Like any other plugin, it must be enabled before it can be used.
please refer below URL:
https://www.rabbitmq.com/management.html
Stop rabbitmq
Create the RABBITMQ_BASE environment variable set its value to full
path of rabbit mq server. (eg. C:\Program Files\RabbitMQ Server)
Restart the rabbit mq and make sure the rabbit mq plugin is enabled.

How to bind DatagramSocket to particular port in Openshift

I am running siple java jar service on openshift which tried to connect with DatagramSocket and Getting this Exception:
java.net.BindException: Permission denied
at java.net.PlainDatagramSocketImpl.bind0(Native Method)
at java.net.AbstractPlainDatagramSocketImpl.bind(AbstractPlainDatagramSocketImpl.java:96)
at java.net.DatagramSocket.bind(DatagramSocket.java:397)
at java.net.DatagramSocket.<init>(DatagramSocket.java:251)
at java.net.DatagramSocket.<init>(DatagramSocket.java:304)
at java.net.DatagramSocket.<init>(DatagramSocket.java:276)
at com.gasmps.service.TerminationListener.run(EmailService.java:542)
at java.lang.Thread.run(Thread.java:745)
I know this is port permission problems but i tried with port like 8000,8443,15005,16005 but getting same how could i resolve this? How i can know all open port that can i use in my application.
Edit: My jboss server is already running in the same application and I don't want to create separate application for these jar service bcos I have to run this jar from my application from remote location.
Iv looked into this before after having the same issue and discovered the answer on stack-overflow before:
In Openshift, you may only bind to the port that the server allocates
for you. Typically that is the value of the environment variable
$OPENSHIFT_JBOSS_PORT (it varies between cartridges) and the value
differs between gears. Binding to any other port will be reported as
an SELinux policy violation and denied.
link
The port is usually 8080
you can bind your app to 8080 (not to 8000 or 8443), all traffic >received on 8000 and 8443 will be routed by the proxy to your app >listening on 8080.
This worked for me, but let me know how it goes and if it still doesn't work i'll try and help.

Remote debugging from eclipse

I am trying to remote a debug an application which is deployed through Websphere. I have all the port configured correctly on server side and on eclipse side. I can use
telnet host port
to connect to remote host and port correctly. But When I try to connect through remote debug through eclipse, I run into the error
Failed to connect to remote VM
com.sun.jdi.connect.spi.ClosedConnectionException
What can be the possible causes for this? I have checked and searched Stackoverflow for this error already. I have tried the most things from answer on this question Eclipse Error: "Failed to connect to remote VM"
I changed the port and it worked. It was a networking issue with that port of 7777.

Not able to connect to remote cassandra

I am trying to access Cassandra(2.1.0) installed on my machine from other machine using my ip address. Here is how I am trying to do it in other machine:
Cluster cluster = Cluster.builder().addContactPoint("192.168.3.51").build();
Session session = cluster.connect("adaequare");
But I am not able to access it. Here are few configurations from Cassandra installed on my machine:
listen_address: localhost
start_native_transport: true
native_transport_port: 9042
rpc_address: localhost
rpc_port: 9160
I tried changing localhost to my ip address. But it did not work either. Do I have to make any other changes in my cassandra.yaml to get this done?
You need to post the error. By saying "It didn't work" gives no clue at all.
Anyway, rpc_addressin cassandra.yaml should point to the IP you configured. In case it is 192.168.3.51, then it needs to go there.

Categories