- DB usage
- JMS usage
- Prepare statement pool
Links :
First item: Connect to the JMX weblogic Server
- My First approach was to use an external (Failed)
- Second approach Is to create my Java Library and catalog it as a Java Component (Succedded)
I can not connect to the server using JMX from outside , for security reasons, but I do can connect using the local connection. That is why I use
private MBeanServer getMBeanServer() throws NamingException {
MBeanServer server;
InitialContext ctx = new InitialContext();
server = (MBeanServer) ctx.lookup("java:comp/env/jmx/runtime");
return server;
}
So this is how I will get my connection to the Weblogic MBeanServer access. Things I need to take care of :
- This method need to be runs on server since I like to monitor the engine I need to get the MBeanServer from the engine not PAPI
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class JMXMonitor {
public static void main(String[] args) throws Exception {
}
public Object invokeMBeanMethod(String mBeanName, String methodName, Object[] args, String[] signature) throws Exception {
MBeanServer mBeanServer = getMBeanServer();
ObjectName name = new ObjectName(mBeanName);
return mBeanServer.invoke(name, methodName, args, signature);
}
public Object getMBeanAttributeValue(String mBeanName, String attributeName) throws Exception {
MBeanServer server = getMBeanServer();
ObjectName name = new ObjectName(mBeanName);
return server.getAttribute(name, attributeName);
}
private MBeanServer getMBeanServer() throws NamingException {
MBeanServer server;
InitialContext ctx = new InitialContext();
server = (MBeanServer) ctx.lookup("java:comp/env/jmx/runtime");
return server;
}
}
So once I can get the this done I have 50% of the problem resolved.
No hay comentarios:
Publicar un comentario