Non-Java JMX client - java

Is it possible to create a JMX client that doesn't run on the JVM?
From my understanding JMX is a protocol on top of other protocols (like RMI) so it should be possible to create a C or Go client. Any reason why this hasn't been done?
I am aware of Jolokia and realise it can be used as a proxy.

Related

Is remote JMX security out-of-the-box really so basic or am I missing something?

I just spent the day building and rebuilding docker images of my app with different variations of JVM command line options -Dcom.sun.management.jmxremote....
So I can get JMX authentication to work which was one step forward, but then anybody in my organisation could login and execute JMX commands.
But it seems to me that I have to rely on putting usernames and passwords in text files in my docker containers (or accessible to them) if I want to restrict authorization to a small group of users.
Isn't there another out-of-the-box way to monitor memory and threads and manipulate loggers or connection pools etc in production?
The official docs Monitoring and Management Using JMX Technology are not encouraging.
I thought microservices architecture might have a new approach but I can't find it on the web or on stackoverflow.
I investigated coding up a routine to launch the JMX server internally with custom authorization to use the Krb5LoginModule to access AD groups following JMX Authentication - Role Based MBean Operations and Support for Kerberos Authentication/Authorization on JMX Client/Server running on Java 6
I even dredged up a long-since vanished Oracle blog post on the subject at the waybackmachine: Authentication and Authorization in JMX RMI connectors
Now at the end of the day it's obvious that I have to keep it simpler than this and go with the out-of-the-box solution, but that is so primitive and looks like it hasn't been improved since Java 1.6.
Is JMX just a basic mechanism to allow EJB containers to do JMX, which of course being gargantuan EJB containers, they have their own JMX connectors that pre-authorize everything.
Isn't there something that will allow me to implement AD groups for authorization in a multi-user environment without writing my own JMX security module?

Post JMS message to Weblogic throught PHP

I have a web application that has communicate with other Java web application throught JMS in Weblogic.
I read this answer:
How to connect Jms from PHP ?
I installed ActiveMQ and tried to use it.
But in the Weblogic we need "JMS_FACTORY" and "QUEUE_NAME".
I think it use t3 protocol.
When I want to use is ActiveMQ, it needs tcp protocol.
for example:
$stomp = new \Stomp('tcp://10.x.x.x:9700');
Is that possible to push messages in the Weblogic queue?
I think you mix API, wire protocol and client vs server in your question.
WebLogic JMS builds on java constructs all the way from Client to Server. If you really really need queue support I guess you need to create a PHP extension (in C/C++) that uses WebLogic C API (which in turn is a Java bridge). Maybe not smooth or bug free.
The easy way is to write a small WebLogic app that receives messages over HTTP and posts them to a queue. Or, if you can't touch the WebLogic installation, create a Standalone java app that you connect to your PHP in whatever way (HTTP, STOMP, MQTT, memory grid, files, whatever)

Access JMX via Golang

I need to access JMX of a running process via TCP. I can't install third party utilities on the machine such as Jolokia to make JMX accessible via HTTP. Is there a library that will let Golang speak JMX or Java RMI? Has a JMX client been implemented in any non-JVM language that I can use as inspiration for a Golang port? Both read and write access would be preferable but I'll settle for read-only.
Don't know if there is a way to talk to JMX in golang without jolokia. I've done it using the golokia project which I forked and made some changes.
Here it is, hope it helps.
https://github.com/joaoh82/golokia

Can I use JMS with a regular (i.e not Java EE) Java Application?

I'd like to use the Java Message Service but it says it's for the Java EE Platform. Is there a way to port it to a regular Java application (which I'm working on in Eclipse)?
JMS is part of the Java EE spec, but you can use it from any Java application. Depending on your needs, you may have to run a standalone broker, but this is just like running a regular daemon (or Windows service).
Yes, you absolutely can use JMS from a J2SE application. In fact, you can access a JMS broker from programs not written in Java at all. The ActiveMQ JMS server includes several transport connectors. The connectors allow clients to interact with ActiveMQ using different communication protocols. Most Java clients use the openwire connector. I've written a PHP client that used the STOMP protocol with great success. It consumed messages sent to a JMS Queue by a Java application running in the Tomcat Servlet Container.
This is a much more complicated question than the answer would indicate. Jms is a spec. Really just a set of interfaces. You can absolutley use those interfaces from a standalone java process. Hell you could write your own jms compliant messaging implementation. Questions you should be asking yourself is what messaging implementation will i be using and does it support jms? Even after answering that there are numerous caveats to take into account when connecting to brokers outside of a container including but not limited to transactionality, load balancing, connection pooling, and high availability. You should be very clear about what your trying to do and what messaging vendor you are working with before you can answer this completely
Many Messaging servers also provides their java api for the communication like MQ, open source Apache ActiveMQ. In that case you don't realy need to worry about JMS. You simply need to understand and use that API.

Access JMX agents from non-Java clients

For some integration projects I would like to query JMX agents from non-Java clients.
I found two options so far, ws-jmx-connector (Soap based) and mx4j and its JMX HTTP adaptor which returns XML document responses. The JSR 262 based ws-jmx-connector seems to be no longer in active development. I have not tried MX4J so I do not know if it is possible to use the HTTP adaptor with the standard JMX implementation in the J2SE.
Are there other software projects which can help to connect non-Java clients with JMX agents, using open standard protocols?
Update: meanwhile I found this project, a "Restful JMX Adaptor". It is also described in the article RESTful Access to JMX Instrumentation, Via URI-fication of MBean Attributes
I recommend Jolokia, which is a full featured JSON/HTTP adapter for JMX. It has several client libs, i.e. jmx4perl, which allows for programatic JMX access from within perl. For Java and Javascript there are client bindings, too. More are in the pipeline (Scala, Groovy, Python). The installation is dead easy, for a Java EE container it is as simple as deploying a standard Java EE war. Other agents (OSGi, Mule, JVM6) are available, too.
Jolokia is a agent based and implies that I install a server and agents. What I am after is a lightweight pure command line, non-java based, non-agent based solution to call JMX/RMI interface.
Let it be a C-code application or perl or python whatever as long as it is fast.

Categories