JBoss HornetQ JMX access - jboss

We have HornetQ messaging running inside JBoss. From a remote VM we are unable to connect using JMXURL.
HornetQ settings (hornet1 configuration.xml):
<jmx-management-enabled>true</jmx-management-enabled>
JBoss settings
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
From a remote JVM none of these URLs work:
service:jmx:rmi:///jndi/rmi://localhost:8070/jmxrmi
service:jmx:rmi:///jndi/rmi://127.0.0.1:8007/jmxconnector

As for JBoss 6.0.0
jconsole service:jmx:rmi://localhost/jndi/rmi://localhost:1090/jmxconnector
works. If you replace localhost with your host address, it worked as well.
Note that I started JBoss using
run.sh -c whatever --host=0.0.0.0
so that JBoss binds to all interfaces/addresses (instead of localhost only):
--host=host_or_ip ... Bind address for all JBoss services

I have changed the run.sh to :
export JMX_ARGS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
java $JVM_ARGS -classpath $CLASSPATH $JMX_ARGS org.hornetq.integration.bootstrap.HornetQBootstrapServer $FILENAME
then when hornetq starts you should see this in the log :
15:15:22,312 CONFIG [sun.management.jmxremote] JMX Connector ready at: service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi
on the client side you should be able to connect to the server with this :
val url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi")
val connection = JMXConnectorFactory.connect(url, new java.util.HashMap())
def mbeanServer = connection.getMBeanServerConnection()
val objectName = new ObjectName("org.hornetq:module=Core,type=Server")
val serverInfo = mbeanServer.getMBeanInfo(objectName)
println(serverInfo.getDescription())

Related

Enable JMX port for monitoring kafka

Using reference to https://docs.microfocus.com/itom/MP_for_Apache_Kafka:1.10/Kafka/Kafka_JMX,
I created the jmx_local.config and modified the Kafka start up script)
The Kafka start up script picks the jmx_local.coonfig but the port is not getting exposed.
This is what I see on grepping the java process:
"/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.config.file=/usr/local/etc/kafka/jmx_local.conf kafka.Kafka /usr/local/etc/kafka/server.properties"
cat /usr/local/etc/kafka/jmx_local.conf
Dcom.sun.management.jmxremote.port=9395
Dcom.sun.management.jmxremote.authenticate=false
Dcom.sun.management.jmxremote.ssl=false
Also tried with port 10167 but the port is not enabled. Also modified as 'com.sun.management.jmxremote.port=9395'
I could see the other jmx properties.
Any suggestion please
I did grep -rl "jmxremote" /usr/local/Cellar/kafka/2.6.0, and found the jxm config was considered from bin/kafka-run-class.sh. So added 'Dcom.sun.management.jmxremote.port=9395' in bin/kafka-run-class.sh and restarted the kafka service.
To find if the port is available:
netstat -an | grep 1099

JMX Connection refused on Kubernetes with AdoptOpenJDK OpenJ9

With my team we are trying to move our micro-services to openj9, they are running on kubernetes. However, we encounter a problem on the configuration of JMX. (openjdk8-openj9)
We have a connection refused when we try a connection with jvisualvm (and a port-forwarding with Kubernetes).
We haven't changed our configuration, except for switching from Hotspot to OpenJ9.
The error :
E0312 17:09:46.286374 17160 portforward.go:400] an error occurred forwarding 1099 -> 1099: error forwarding port 1099 to pod XXXXXXX, uid : exit status 1: 2020/03/12 16:09:45 socat[31284] E connect(5, AF=2 127.0.0.1:1099, 16): Connection refused
The java options that we use :
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.rmi.port=1099
We are using the last adoptopenjdk/openjdk8-openj9 docker image.
Do you have any ideas?
Thank you !
Regards.
I managed to figure out why it wasn't working.
It turns out that to pass the JMX options to the service we were using the Kubernetes service descriptor in YAML. It looks like this:
- name: _JAVA_OPTIONS
value: -Dzipkinserver.listOfServers=http://zipkin:9411 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.rmi.port=1099
I realized that the JMX properties were not taken into account from _JAVA_OPTIONS when the application is not launch with ENTRYPOINT in the docker container.
So I pass the properties directly into the Dockerfile like this and it works.
CMD ["java", "-Dcom.sun.management.jmxremote", "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.local.only=false", "-Dcom.sun.management.jmxremote.port=1099", "-Dcom.sun.management.jmxremote.rmi.port=1099", "-Djava.rmi.server.hostname=127.0.0.1", "-cp","app:app/lib/*","OurMainClass"]
It's also possible to keep _JAVA_OPTIONS and setup an ENTRYPOINT in the dockerfile.
Thanks!

JBoss 7.1.1 + mod_cluster : Session replication - Can't find resource org.jboss.as.web.session.LocalStrings

I am running JBoss 7.1.1 instances and httpd + mod_cluster in the standalone mode
Machine1: JBoss 7.1.1 , Apache httpd + mod_cluster (windows 7)
Machine2 : JBoss 7.1.1 (windows 7)
I am starting the nodes in with the below command
standalone -c standalone-ha.xml -b 192.168.4.76 -u 230.0.0.4 -Djboss.server.base.dir=../standalonenode1 -Djboss.node.name=node1
standalone -c standalone-ha.xml -b 192.168.4.81 -u 230.0.0.4 -Djboss.server.base.dir=../standalonenode2 -Djboss.node.name=node2
Apache httpd is installed as a service,configured with JBoss mod cluster subsystem.
I have written a sample application to test the session replication. When the node1 is down, the session object becomes null. The following contents are from server.log file,
22:36:23,111 DEBUG [org.apache.tomcat.util.http.Cookies] (ajp--192.168.4.81-9595-1) Cookies: Parsing b[]: JSESSIONID=yzC5kdQ1jre0T2FnNhVAI6J6.standalonenode1
22:36:23,134 DEBUG [org.apache.catalina.util.StringManager] (ajp--192.168.4.81-9595-1) Can't find resource org.jboss.as.web.session.LocalStrings ModuleClassLoader for Module "deployment.sampleSession-1.0.war:main" from Service Module Loader
The above setup is completely working fine in a remote environment(windows 2012) and i tried to set it up locally with windows 7 machines.
I opened up jboss-as-web-7.1.1.Final.jar and there is no class file with the name org.jboss.as.web.session.LocalStrings.
Please help.
Thanks
Venkat

Run two instances of JBoss Fuse on the same box

What configuration files/values to change in order to run second instance of the JBoss Fuse on the same box?
Second instance properties after configuration:
Installation home: c:\jboss-fuse-6.2.1.redhat-084-2 (/usr/app/jboss-fuse-6.2.1.redhat-084-2)
Remote debug port: 5006
Jetty/CXF port: 8282
RMI registry port: 2099
RMI server port: 54444
SSH port: 8202
ActiveMQ port: 62616
HawtIO console: http://localhost:8282/hawtio/login
Installation home:
$JBOSS_FUSE_HOME\bin\setenv
----
KARAF_HOME=/usr/app/jboss-fuse-6.2.1.redhat-084-2
KARAF_DATA=/usr/app/jboss-fuse-6.2.1.redhat-084-2/data
KARAF_ETC=/usr/app/jboss-fuse-6.2.1.redhat-084-2/etc
export KARAF_HOME
export KARAF_DATA
export KARAF_ETC
%JBOSS_FUSE_HOME%\bin\setenv.bat
----
SET KARAF_HOME=c:\jboss-fuse-6.2.1.redhat-084-2
SET KARAF_DATA=c:\jboss-fuse-6.2.1.redhat-084-2\data
SET KARAF_ETC=c:\jboss-fuse-6.2.1.redhat-084-2\etc
Remote debug port
$JBOSS_FUSE_HOME\bin\admin
$JBOSS_FUSE_HOME\bin\karaf
$JBOSS_FUSE_HOME\bin\patch
----
DEFAULT_JAVA_DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006"
%JBOSS_FUSE_HOME%\bin\admin.bat
%JBOSS_FUSE_HOME%\bin\karaf.bat
%JBOSS_FUSE_HOME%\bin\patch.bat
----
set DEFAULT_JAVA_DEBUG_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006
Jetty/CXF port
JBOSS_FUSE_HOME\etc\jetty.xml
---
<Property name="jetty.port" default="8282"/>
JBOSS_FUSE_HOME\etc\org.ops4j.pax.web.cfg
---
org.osgi.service.http.port=8282
JBOSS_FUSE_HOME\etc\system.properties
---
org.osgi.service.http.port=8282
RMI registry port/RMI server port
JBOSS_FUSE_HOME\etc\org.apache.karaf.management.cfg
---
rmiRegistryPort = 2099
rmiServerPort = 54444
SSH port
JBOSS_FUSE_HOME\etc\org.apache.karaf.shell.cfg
---
sshPort = 8202
ActiveMQ port
JBOSS_FUSE_HOME\etc\system.properties
---
activemq.port = 62616
activemq.host = localhost
This depends on the applications installed, so let's stick with vanilla JBoss Fuse 6.2+
There are 3 components that need a change in configuration:
ActiveMQ broker
Hawtio web interface
sshd
Conflicts happen while binding on TCP/IP ports. Use two sets of ports and you're done.
Configuration files are located in $KARAF_ETC folder, usually etc/ inside JBoss Fuse installation folder.
ActiveMQ
Change property activemq.port inside etc/system.properties.
Default value is 61616.
Hawtio / OSGi HTTP
Change property org.osgi.service.http.port inside etc/system.properties. Default is 8181.
This is also defined in etc/org.ops4j.pax.web.cfg.
SSH
Change property sshPort inside etc/org.apache.karaf.shell.cfg. Default is 8101
Another way: Create a Fabric with two child containers. Each container is just like a regular instance. The infrastructure is just a bit more complex than the standalone one.

error in eclipse --- java.lang.RuntimeException: Could not start Selenium session: null

Used jdk 7
selenium-server-standalone-2.25.0.jar
eclipse java indigosr1win32.
When I run my server, by cmd:
java - jar selenium-server-standalone-2.25.0.jar 4444
the server's stopping by itself after showing some message, and getting next prompt:
server not working properly.
When I run my program I got an error in eclipse:
java.lang.RuntimeException: Could not start Selenium session: null
Don't specify port number 4444 ...Selenium server by default will run on port 4444.
Write on CMD java - jar selenium-server-standalone-2.25.0.jar
If you want to give port no ...Specify as
java - jar selenium-server-standalone-2.25.0.jar -port 4445