Using JConsole to view JMX MBeans of Weblogic Server

1. Set the environment using setWLSEnv.cmd 2. Start JMX Console using the below arguments and connect to the local/remote process. jconsole -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -J-Dcom.sun.tools.jconsole.mbeans.keyPropertyList=Location,type,Type,j2eeType,name,Name -debug   3. Go to the Mbeans tab and view the Mbeans  

Continue reading »

Sample JMX Code to retrieve JDBC Connection Pool Parameter

import java.io.IOException; import java.util.*; import javax.management.*; import javax.management.remote.*; import javax.naming.Context; import weblogic.jndi.Environment; import weblogic.management.*; public class JDBCConnectionPoolProperties { static MBeanServerConnection connection; static JMXConnector connector; static ObjectName service; public static void main(String[] args) { try { JMXServiceURL serviceURL = new JMXServiceURL("t3", "localhost", 80, "/jndi/weblogic.management.mbeanservers.domainruntime"); service = new ObjectName( "com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean"); Hashtable h

Continue reading »

Automating application deployment on Weblogic Server.

In this article we will demonstrate three ways of deployment and undeployment on Weblogic Server 1. Using WLST 2. Using JMX 3. Using build script. Application Deployment using WLST connect(‘weblogic’,’weblogic’,’t3://localhost:7001′) edit() startEdit() deploy(‘CookieApp’,’D:/Replications/CookieApp’,targets=’AdminServer’) save() activate() exit() Application Undeployment using WLST connect(‘weblogic’,’weblogic’,’t3://localhost:7001′) edit() startEdit() undeploy(‘CookieApp’) save() activate() exit() Application Deployment using

Continue reading »

JMX Policy Editor to modify Deployer role

The below post describes how we can modify the default policy settings for the Deployer role users. By default the user with Deployer role cannot start / stop the JDBC Data Source. There could be situations where you would like to provide the permissions to do so. While trying to

Continue reading »

List Users and Groups in Weblogic using JMX

There are times when an Application Needs to interact with the Weblogic Server Embedded LDAP Server and Add/Modify/List users or groups. Weblogic Server provides UserReaderMBean, UserRemoverMBean, GroupReaderMBean, GroupRemoverMBean for this purpose. Below you will find a sample to list users and groups present in the Embedded Ldap Server. This program

Continue reading »

JMS Resources using JMX

import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import javax.management.MBeanServerConnection; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import javax.naming.Context; import javax.naming.InitialContext; import weblogic.j2ee.descriptor.wl.JMSBean; import weblogic.j2ee.descriptor.wl.JMSConnectionFactoryBean; import weblogic.j2ee.descriptor.wl.QueueBean; import weblogic.jms.extensions.JMSModuleHelper; import weblogic.management.configuration.JMSSystemResourceMBean; public class JMSResource { private static MBeanServerConnection connection; private static JMXConnector connector;

Continue reading »

Registering Custom MBeans with Weblogic Server

Registering Custom Mbeans with Weblogic Server. Example.java package jmxMbeans; public class Example implements ExampleMBean { public void sayHello(String str) { System.out.println(“Hello ” + str + “‘!”); } } ExampleMbean.java package jmxMbeans; public interface ExampleMBean { void sayHello(String name); } Index.jsp <%@ page import=”javax.management.MBeanServer”%> <%@ page import=”javax.management.ObjectName”%> <%@ page import=”javax.naming.Context”%> <%@

Continue reading »

Force Shutingdown WLS Using JMX

import java.io.IOException; import java.net.MalformedURLException; import java.util.Hashtable; import javax.management.MBeanServerConnection; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import weblogic.management.runtime.*; import javax.naming.Context; import java.lang.*; public class ShutdownServerUsingJMX { private static MBeanServerConnection connection; private static JMXConnector connector; private static final ObjectName service; static { try { service=new ObjectName(“com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean”); } catch (MalformedObjectNameException

Continue reading »