How to access JMX metrics using kafka.tools.JmxTool? - apache-kafka

I am unable to get JMX metrics using bin/kafka-run-class.sh kafka.tools.JmxTool script. However, I am able to connect to process using Jconsole.
I have set following properties:
com.sun.management.jmxremote = true
com.sun.management.jmxremote.authenticate = false
com.sun.management.jmxremote.local.only = false
com.sun.management.jmxremote.port = 9145
com.sun.management.jmxremote.ssl = false
Exception:
? kafka_2.11-2.1.0/bin/kafka-run-class.sh kafka.tools.JmxTool --jmx-url service:jmx:rmi:///jndi/rmi://kafkatest-01:9154/jmxrmi
Trying to connect to JMX url: service:jmx:rmi:///jndi/rmi://kafkatest-01:9154/jmxrmi.
Could not connect to JMX url: service:jmx:rmi:///jndi/rmi://kafkatest-01:9154/jmxrmi. Exception Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: kafkatest-01; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)].
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: kafkatest-01; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)]
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:369)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:270)
at kafka.tools.JmxTool$.main(JmxTool.scala:120)
at kafka.tools.JmxTool.main(JmxTool.scala)
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: kafkatest-01; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:136)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:205)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1955)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1922)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:287)
... 3 more

Trying to connect to JMX url: service:jmx:rmi:///jndi/rmi://kafkatest-01:9154/jmxrmi.
but your port is 9145
com.sun.management.jmxremote.port = 9145
Want to know what properties are actually set on your running JVM (useful for checking stuff like this)
prompt> jcmd $pid VM.system_properties

Related

dubbo+nacos Connection refused: no further information

dubbo + nanos startup porject appears:
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: /192.168.10.64:20882#
already set #dubboReference(check = false)
Finally, the project cannot be started
How to resolve?

Connection Refused and Cannot connect to Controller Error

I am getting an error when i try to stop services
Failed to connect to the controller: The controller is not available at localhost:9990: java.net.ConnectException: WFLYPRT0053: Could not connect to http-remoting://localhost:9990. The connection failed: WFLYPRT0053: Could not connect to http-remoting://localhost:9990. The connection failed: Connection refused
when i try to start services, i get below error and need to restart the server multiple times to resolve it. need a solution to avoid errors during start and stop services. we use keycloack sercurity as well
2020-02-11 19:21:01,191 WARNING [com.lgc.dsl.admin.security.controllers.DSSecurity] (default task-12) Connect to localhost:8880 [localhost/IP] failed: Connection refused (Connection refused)
2020-02-11 19:21:09,462 WARN [org.kie.server.services.impl.controller.DefaultRestControllerImpl] (KieServer-ControllerConnect) Exception encountered while syncing with controller at http:localhost:port/dsbpm-console/rest/controller/server/dsbpm-kieserver error Error while sending PUT request to localhost:port/dsbpm-console/rest/controller/server/dsbpm-kieserver response code 405
Default kie server is not showing up in the server section
2020-02-11 19:21:01,191 WARNING [com.lgc.dsl.admin.security.controllers.DSSecurity] (default task-12) Connect to localhost:8880 [localhost/IP] failed: Connection refused (Connection refused)
2020-02-11 19:21:09,462 WARN [org.kie.server.services.impl.controller.DefaultRestControllerImpl] (KieServer-ControllerConnect) Exception encountered while syncing with controller at http:localhost:port/dsbpm-console/rest/controller/server/dsbpm-kieserver error Error while sending PUT request to localhost:port/dsbpm-console/rest/controller/server/dsbpm-kieserver response code 405
Check if you have 'dsbpm-console' for 'org.kie.server.controller' property, like as:

JBoss EAP on Eclipse does not have jndi service

I was trying to follow some EJB tutorial, most of them started talking about JNDI, and I am having trouble to get the service running on the JBOSS AS.
I have tried both the community and EAP version of JBoss in Eclipse, but both fails.
So now whenever I run lines like BeanRemote beanRemote = (BeanRemote) context.lookup("somecontext"); it throws these error.
javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]
Caused by: java.net.ConnectException: Connection refused: connect
well of course it is caused by the port not opened, but I think its because the Jboss server is not providing the service, although its web port and admin port 8080 and 9990 is working fine.
I am using eclipse Oxygen 4.7.0, I have downloaded the Red Hat JBoss developer Studio. I added the server via the "New Server" wizard, then downloaded the server runtimes within the wizard. However there just seems no way to configure jndi, nor can I find any file that is related to jndi or jnp in the downloaded path. The XML configuration showed that only Management 9990 and Web 8080 port is open.
I don't understand why is this not enabled by default, and I don't know what to do. Is JNDI configurable somewhere in the management console? please help
Turns out method of linking to jndi changed in EAP 7 from EAP 5
this articles shows the correct method.
jndi.properties has been changed to jboss-ejb-client.properties, and the standard config now becomes
endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=yourhostaddress
remote.connection.default.port = 8080
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
and context lookup string has been changed to
ejb:<app-name>/<module-name>/<distinct-name>/<bean-name>!<fully-qualified-classname-of-the-remote-interface>

Payara Glassfish 4.1.1 will not start in Netbeans 8.2 MacOSX

Glassfish freezes at:
Information: JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://192.168.0.119:8686/jndi/rmi://192.168.0.119:8686/jmxrmi
I have tried to reinstall netbeans, reinstall glashfish, others projects also not working.
I get sometimes an error message:
Please check server admin user name and password properties.
Also please check the server log file for other possible causes.
And i think there is no new server.log file created but the file contains:
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.0.117; nested exception is:
Caused by: java.rmi.ConnectException: Connection refused to host: 192.168.0.117; nested exception is:
Caused by: java.net.ConnectException: Operation timed out (Connection timed out)
Caused by: javax.naming.ConfigurationException [Root exception is java.rmi.UnknownHostException: Unknown host: eleonores-air; nested exception is:
Caused by: java.rmi.UnknownHostException: Unknown host: eleonores-air; nested exception is:
Caused by: java.net.UnknownHostException: eleonores-air
Please help me to find a solution.

JBoss Server stopping error

I am using JBoss Server in my project.
The JBoss version is 4.2.3
When I am stopping the server, at that time the server is giving error and is not getting stopped.
The console is showing the following error:
Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1562)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at org.jboss.Shutdown.main(Shutdown.java:214)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:274)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
... Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:248)
... Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:328)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:244)
I know that this question is old but I've faced the same error and I've found the solution.
I edited the jboss-service.xml file that is located at the following path:
<_jboss_installation_folder_>/server/<_instance_name>_/conf
You have to find the NamingService mbean:
<mbean code="org.jboss.naming.NamingService" name="jboss:service=Naming" xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
and change the port attribute to 1099, eg:
<attribute name="Port">1099</attribute>