Java Mission Control: Flight Recorder throws: javax.naming.ServiceUnavailableException - java

I am trying to profile a Java Spring application with the Oracle Java Mission control.
I have the JVM Connection configured as: localhost:7091
and I started the application with java -Dcom.sun.management.jmxremote.rmi.port=7091 -jar app.jar.
When I attempt to start the flight recorder I get an error message.
Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect]
Could not connect to a JVM at service:jmx:rmi:///jndi/rmi://localhost:7091/jmxrmi. Make sure one is running and that you are using the correct protocol in the Service URL.
Does anyone know what could be the reason for that error?

You could try to use auto discovery. Then the connection will show up automatically in JMC
-Dcom.sun.management.jmxremote.autodiscovery=true
You can also name the connection so you can identify it easily.
-Dcom.sun.management.jdp.name=App
and disable security
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

I had this issue. I had installed JDK 10 on Windows Server 2016. With JMC and the JVM I wished to monitor on the same server.
When going live, we switched the IP from a temporary IP to a live IP. However, JMC resolved localhost to the original IP. Also when specifying the server's current IP, JMC resolved it to the original IP.
Adding -Djava.rmi.server.hostname=localhost to the Java process I wanted to monitor, resolved the issue.
However, I will would still be interested to know why JMC (or RMI) still resolves incorrectly.

Related

Start jmeter distributed testing from clouds

I want to run distributed load testing by jmeter, where servers(linux) are in the cloud and I have ability to start test from my local pc.
Is it even possible or client and servers should be in same subnet?
And in case its possible, may you provide me step by step guide how to achive this goal?
I have tired
https://jmeter.apache.org/usermanual/remote-test.html
https://cloud.google.com/community/tutorials/ssh-port-forwarding-set-up-load-testing-on-compute-engine?hl=ja
but I got error after error.
Before I disabled ssl verification, next error appeared:
error during JRMP connection establishment; nested exception is:
javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
With disabled ssl verification I have next error:
Error in rconfigure() method java.rmi.MarshalException: error marshalling argume
nts; nested exception is:
java.net.SocketException: Connection reset by peer: socket write error
I have feeligs, like I making smth wrong with setting ip, port or firewall, but cant understand what
It is definitely possible to starts load agents (jmeter-server) from your local system. The only condition is that the traffic should not be blocked by firewall.
Based on your error, it looks like jmeter process is not having permission to open a port, port is already open (although there is a specific exception for this)
You can also try allowing all incoming traffic to your slaves (cloud linux boxes) and try running the test again.
According to the manual you mentioned all you need to do is just to take the following steps:
On your local machine set up the SSH tunnel:
ssh -L 24000:127.0.0.1:24000 -R 25000:127.0.0.1:25000 -L 26000:127.0.0.1:26000 username#hostname_of_cloud_machine
On the cloud machine launch the JMeter slave
./jmeter -s -Jserver.rmi.ssl.disable=true -Jserver_port=24000 -Jserver.rmi.localhostname=127.0.0.1 -Jserver.rmi.localport=26000 -j jmeter.log
Again on the local machine launch the JMeter master:
./jmeter -Jserver.rmi.ssl.disable=true -Jremote_hosts=127.0.0.1:24000 -Jclient.rmi.localport=25000 -Jmode=Statistical -n -t test.jmx -l result.jtl
You don't need to configure any firewalls as all the communication is happening over the SSH tunnel
More information:
Remote hosts and RMI configuration
Apache JMeter Properties Customization Guide

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 connect to a Grakn Server running on a GCP VM instance

I'm trying to connect to a Grakn Server running on a GCP VM instance. I have read the related post in the discussion forum. One of the replies suggests to do the following on the server side:
Edit ./conf/main/grakn.properties:
storage.hostname=EXTERNAL.ip.v4.address
Edit ./conf/cassandra/cassandra.yaml:
seeds: "EXTERNAL.ip.v4.address"
broadcast_address: EXTERNAL.ip.v4.address
listen_address: INTERNAL.ip.v4.address
rpc_address: INTERNAL.ip.v4.address
Access it from the Java API:
GraknSession session = Grakn.session(“EXTERNAL.ip.v4.address”, keySpaceName);
What i have interpreted from this, for my specific case, is the following:
-Replace EXTERNAL.ip.v4.address with the External IP of my VM instance
-Replace INTERNAL.ip.v4.address with the Internal IP of my VM instance
When i start the server i get this exception cause (I think this is the root cause):
Caused by:
com.netflix.astyanax.connectionpool.exceptions.PoolTimeoutException:
PoolTimeoutException: [host=104.197.131.17(104.197.131.17):9160,
latency=10000(10000), attempts=1]Timed out waiting for connection
at com.netflix.astyanax.connectionpool.impl.SimpleHostConnectionPool.waitForConnection(SimpleHostConnectionPool.java:231)
What am i missing?
Do i have to add firewall rules?
Thanks for the help.
To access Grakn remotely using the Java API, you need to open the following ports on the GCP and Linux VM firewall (eg. iptables):
4567
9160
Make sure you are able to access those from the client machine.

cant connect my driver to from eclipse to sql server [duplicate]

This question already has answers here:
JDBC connection failed, error: TCP/IP connection to host failed
(9 answers)
Closed 5 years ago.
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:191)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:242)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2369)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:551)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1963)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459)
I'm facing this exception after I tried to connect with my driver through the new database profile.
The information I have was correct and the TCP port was enabled and the firewall was turned off.
I'm using Microsoft SQL server 2008 JDBC driver and I've added the jars.
A "connection refused" is rarely caused by the connecting client, i.e. the JDBC client within your Eclipse setup. A good check is to open a shell (e.g. cmd.exe on Windows) and do a
telnet [server name used in JDBC configuration] 1433
On newer Windows installations you need to install the telnet client because it's not part of the standard installation anymore (Settings -> Software -> Add/Remove Features).
If that leads to a similar error message you can focus your trouble shooting to the network part of your system, since the JDBC side is completely uninvolved. If you can connect, make sure that the server name resolves to the same IP when using the command prompt as it's resolved within Java (I once had this effect which took quite a time to find that out). Especially with localhost as server name one might resolve to 127.0.0.1 while the other resolvs to ::1.

How do I connect to Derby which is included with WebLogic?

I'm trying to add the Derby included with WebLogic as a data source. I'm running WebLogic 10.3.5. I didn't see a Derby flag in the setDomainEnv.cmd, so I added the client driver to the CLASSPATH:
set CLASSPATH=%PRE_CLASSPATH%;%WEBLOGIC_CLASSPATH%;%POST_CLASSPATH%;%WLP_POST_CLASSPATH%;%WL_HOME%\common\derby\lib\derbyclient.jar
in setDomainEnv.cmd. Now when I try to activate my data source in WebLogic I get:
An error occurred during activation of changes, please see the log for
details. Message icon - Error weblogic.application.ModuleException:
Message icon - Error java.net.ConnectException : Error connecting to
server localhost on port 1527 with message Connection refused:
connect.
What else do I need to do to get this to work?
I believe your local derby is not up yet. To check this, issue:
netstat -an | findstr 1527.
See if it returns anything. If nothing is returned, try to start the Derby Network Service manually. Go to <WLS_HOME>\common\derby\bin and click the startNetworkServer.cmd.
Double check with netstat again. If it's there, you can try to add to the datasource.
Note: this only covers manually start the Derby network service (not automatially start it upon weblogic start, which a bit tricky).
Either whatever is supposed to be running on that port isn't running or there is a firewall issue.

Categories