Access JMX agents from non-Java clients - java

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.

Related

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 different application server implementations share Remote EJBs?

After reading the official Java EE docs and after playing with OpenEJB, I am wondering about the capabilities of different application servers to cross-communicate Remote EJBs. Right now, it seems to me that despite the API's standardisation, the inter-process communication is not standardized, for example with the ejbd protocol that only seems to be supported by OpenEJB.
I am in particularly wondering about the protocols that are used for implementing EJB-based RPCs. Until now, I believed that this communication was mostly done via HTTP. From looking into the documentations for WebSphere, JBoss and TomEE, it seems however like every application server cooks its own soup.
My question is therefore: Can different application servers generally communicate via remote EJBs and by what protocol is this typically implemented. And why would an application server like TomEE offer a deriving solution in the first place?
Yes, this is possible. The EJB-Spec requires the support of CORBA/IIOP.
From the EJB 3.1 Spec (Chapter 2.5):
To help interoperability for EJB environments that include systems
from multiple vendors, the EJB specification requires compliant
implementations to support the interoperability protocol based on
CORBA/IIOP for remote invocations from Java EE clients.
Implementations may support other remote invocation protocols in
addition to IIOP.

JMX enabling my Application using Jetty as embedded server

I have a java server application that would like to provide Http
interface to for administrative tasks such as monitoring and
configuring it at run-time and such.
I have some idea that JMX would provide me with a neat standard
interface that if I implement, I would provide a nice standard
management interface that ALL types of management console applications
can use to administor my Server application.
I am wondering if Jetty has a part to play in all of this running
in-process (embedded) into my java application?
what do you think is a best way of managing/monitoring my java application using a web interface?
Appreciate your help
We added a jmx rest interface option in jetty some time ago that might be useful here.
http://webtide.intalio.com/2011/05/jetty-jmx-webservice/
It could easily be pulled from for an admin like interface for management or presentation purposes.
JMX would allow you to expose configuration points for your application. This is required if you desire a programmatic/automated way of configuring your application. Using JMX to configure application is not desirable for a naive users. It is not very likely that they would know how to use JMX. Instead a graphical console would appeal to them. They can simply see what they need to configure, refer any reference material or help and just do it.
It is desirable that you have both the options; a web console and also the JMX way for programmatic access.
Secondly, you dont need a any third party server to JMX-enable your application. You simply create an instance of MBeanServer and it will host your mbeans.

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.

Difference between an application client and a stand-alone client

As the title suggests, this is in relation to Java EE and Glassfish in particular.
From what i've learned the application client is executed in some application client that has the ability to talk to glassfish. But there seems to be limitations to this regarding annotations.
Can someone give me an example of the difference in connecting to a glassfish application server from the two different application types?
What is the benefit of the application client approach, and what approach is the most commonly used when developing application clients for Java EE?
The code (work you need to do) associated with connecting to the app server in either case is not really all that hard... but it is covered in different docs.
These are the instructions on how to access an EJB from a stand-alone java application.
These are the instructions for using an app client to access an EJB from a Java EE 6 Application Client with GlassFish v3: http://docs.sun.com/app/docs/doc/820-7695/beakt?l=en&a=view
Accessing an EJB from an application client gives you access to more of Java EE services 'automagically' than if you were working with the EJB 'directly'. You can cobble together access to some of these services in the stand-alone case, but the burden shifts onto the application developer/deployer to make that access work.
Creating a stand-alone application that accesses an EJB will seem easy, in the short term, and many folks will invest in that strategy. If they deploy their client application onto a large number of machines, the burden associated with a cobbled together service access strategy can become a burden.
Deploying an application client that uses the application client container is not free either. The advantage is the fact that you have the support of your app server vendor to overcome deployment issues.
If you are using GlassFish (v2.1,v2.1.1 or v3), you can also take advantage of Java Web Start support, which simplifies client application deployment a lot.
An application client is actually run in a container and has full access to Java EE resources defined on your server in the same way that a Servlet or EJB does. This would typically be used for some type of admin client, not a user application. Here is one explanation.
In addition to the Java EE Application Client, there is also the concept of a Thin Client, which allows access to some Java EE resources as well, but not as easily as the App Client. It usually involves using JNDI lookup with absolute names as JNDI references are not available. A typical case for this would be a standalone producer/consumer of JMS messages. It is basically a lighter weight option of the full App Client.
If you are simply creating a user application, you will most likely want to either use a Thin Client model, or a plain old application that simply consumes services from your Java EE app via servlet or web service calls.

Categories