ActiveMQ on Windows not enabling JMX - activemq

I am using ActiveMQ 5.16.1 on Windows. I set useJmx="true" in the <broker> section of activemq.xml. However, after starting ActiveMQ nothing is listening on the default JMX port 1099, and JConsole does not show ActiveMQ as a target.
I tried explicitly enabling the JMX connector in activemq.xml:
<managementContext>
<managementContext createConnector="true"/>
</managementContext>
However, I get this failure in the ActiveMQ startup console:
WARN | Failed to start JMX connector Port already in use: 1099; nested exception is:
java.net.BindException: Address already in use: JVM_Bind. Will restart management to re-create JMX connector, trying to remedy this issue.
This returns an empty result
netstat -an | grep 1099

JMX is most likely already running via the startup script-- hence the error message. I'm betting the netstat -na is run after the ActiveMQ process has given you the error and the process has already exited.
This is a confusing bit-- that setting in managementContext should be createConnector="false" when using the Apache ActiveMQ build.
Background: ActiveMQ is essentially a library, so it has features to support running in all sorts of different ways. When you start ActiveMQ from the Apache build download, the JMX settings are usually started using -D parameters found in the bin/setenv script. The managementContext setting is to instruct ActiveMQ s embedded in a different runtime/build that does not start JMX itself.

Related

Apache Active MQ connect exception using Java program from remote machine

I was trying to run Apache Activemq , broker ran successfully at localhost. At same machine JMS producer , consumer Java applications ran successfully . BUT I changed Uri to tcp://192.168.1.1:61616 in activemq.xml and ran the broker in machine 1( 192.168.1.1) . I ran consumer in machine 1. I ran producer from machine 2 in LAN. But producer caused jms exception. ConnectException. Connection refused. As a result producer and consumer can not communicate in LAN . Please guide.
If I understand this correctly you have this setup:
Machine1: ActiveMQ Broker and Consumer
Machine2: Producer
Then you need to setup your configurations like this:
ActiveMQ Broker: in activemq.xml set to tcp://192.168.1.1:61616
Consumer: tcp://192.168.1.1:61616
Producer: tcp://192.168.1.1:61616
Thank you very much. It was firewall that was preventing connection. I disabled firewall, things is running fine. Regards.

jconsole to connect to apachemq

activemq : apache-activemq-5.14.0
jconsole using jdk1.7
I have started the activemq which comes with the jetty server. Minor change to make the jmx enable is by making change in activemq.xml
managementContext createConnector="true" --- default is false
when i start i am seeing the message
JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
So I start Jconsole use remote process and use service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
with no password : it says secure/insecure connection failed: not sure where the problem is
Any help is really appreciated
For jmx default credentials are admin:activemq https://github.com/apache/activemq/blob/master/assembly/src/release/conf/jmx.password
The default username/password are: admin/admin

RabbitMQ and ActiveMQ running on the same machine

For testing purposes I need ActiveMQ and RabbitMQ running on the same Windows machine. I have both installed, but I can't run them together: I need to stop one service in order to have the other one running.
This is the error I get trying to start RabbitMQ having ActiveMQ running:
=INFO REPORT==== 17-Feb-2015::14:24:00 ===
Error description:
{could_not_start,rabbit,
{bad_return,
{{rabbit,start,[normal,[]]},
{'EXIT',
{rabbit,failure_during_boot,
{boot_step,networking,
{case_clause,
{error,
{{shutdown,
{failed_to_start_child,tcp_listener,
{cannot_listen,{0,0,0,0,0,0,0,0},5672,eacces}}},
{child,undefined,'rabbit_tcp_listener_sup_:::5672',
{tcp_listener_sup,start_link,
[{0,0,0,0,0,0,0,0},
5672,
[inet6,binary,
{packet,raw},
{reuseaddr,true},
{backlog,128},
{nodelay,true},
{linger,{true,0}},
{exit_on_close,false}],
{rabbit_networking,tcp_listener_started,[amqp]},
{rabbit_networking,tcp_listener_stopped,[amqp]},
{rabbit_networking,start_client,[]},
"TCP Listener"]},
transient,infinity,supervisor,
[tcp_listener_sup]}}}}}}}}}}
And this is the error I get trying to start ActiveMQ with RabbitMQ already running:
jvm 1 | INFO | Listening for connections at: tcp://BROKER:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1 | INFO | Connector openwire started
jvm 1 | ERROR | Failed to start Apache ActiveMQ ([localhost, ID:DEV-BROKER01-56290-1424197666199-0:1], java.io.IOException: Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server socket: amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to:
java.net.BindException: Address already in use: JVM_Bind)
jvm 1 | INFO | Apache ActiveMQ 5.11.0 (localhost, ID:DEV-BROKER01-56290-1424197666199-0:1) is shutting down
That "Address already in use" is the key I guess.
Any way to sort this out? Thanks
this is the problem:
java.net.BindException: Address already in use: JVM_Bind)
both the brokers use the 5672 port (amqp default port).
just change the port for one broker, for example in rabbitmq check this link:
https://www.rabbitmq.com/configure.html
The configuration file rabbitmq.config allows the RabbitMQ core
application, Erlang services and RabbitMQ plugins to be configured. It
is a standard Erlang configuration file, documented on the Erlang
Config Man Page.
An example configuration file follows:
[
{rabbit, [{tcp_listeners, [5673]}]}
].
This example will the port RabbitMQ listens on from 5672 to 5673.
This configuration file is not the same as rabbitmq-env.conf, which
can be used to set environment variables on non-windows systems.

Glassfish V4 enabling/connecting jmx for remote access

I have gone through lot of blogs etc but could not connect to my glassfish JMX remotely. I have below JVM settings -
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.port=8686
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=myremoteip
I am trying to access via console by using below string
service:jmx:rmi://myremoteip:8686/jndi/rmi://myremoteip:8686/jmxrmi
Above setup doesn't work and i am not sure how can i resolve it. Any help will be appreciated.
In addtion to set JVM parameters listed above, in Glassfish Admin Console Configurations -> server-config -> Admin Service have to set:
Address: server's IP address
Security: not checked
Port: 8686
Realm name: admin-realm
If exists, delete JVM setting "-Dcom.sun.management.jmxremote.port=8686", this
causes "Cannot start JMX connector JmxConnector config..." like exception!
It seems that -Dcom.sun.management.jmxremote is not same as glassfish's own JMX server, but starts another JMX server in addition to servers existing one. I have not found any reasonable way to remotely connect to glassfish's own JMX yet.
If you change the -Dcom.sun.management.jmxremote.port to for example 8786 you should be able to connect to the non-glassfish JMX just fine.

ActiveMQ console not available

I installed ActiveMQ 5.5.0 on my Windows machine, and it had a web console (http://localhost:8161/admin) working out of the box.
Then I installed ActiveMQ (same version) on a remote Linux box (IP: AAA.BBB.CCC.DDD), but whenever I point the browser to
http://AAA.BBB.CCC.DDD:8161/admin
I get the "Unable to connect" error in the browser.
The network connection is there, I can connect to AAA.BBB.CCC.DDD via ssh and to another web application running on the same server.
Therefore I think that the cause of the problem is wrong configuration of the embedded Jetty server of ActiveMQ.
How can fix the problem, i. e. enable the access to the web console from a remote browser?
In your ActiveMQ config file you should see something like:
<import resource="${activemq.base}/conf/jetty.xml"/>
This starts up an embedded Jetty container with the web console.
If you start the broker on the console, you should see the following if everything works
INFO | ActiveMQ WebConsole initialized.
INFO | Initializing Spring FrameworkServlet 'dispatcher'
INFO | ActiveMQ Console at http://0.0.0.0:8161/admin
into /opt/activemq/apache-activemq-5.16.3/conf
open jetty.xml
change
<property name="host" value="127.0.0.1"/>
to
<property name="host" value="0.0.0.0"/>
restart activemq
I used this approach on a linux server running in VM but can be applied to any instance
Check whether 8161 port is opened for external connection. Also check whether another service creating a conflict.
If there is a conflict
change the jetty port in the {activemqfolder}/conf/jetty.xml.
locate the line that contains the 8161 and change it to the desirable port
To enable external connections to the port (in this instance i choose 8169) use
sudo iptables -I INPUT -p tcp --dport 8169 -j ACCEPT
Proceed to start the activemq ie {activemqfolder}/bin/activemq console to see the messages