This discussion is archived
3 Replies Latest reply: Jul 18, 2011 8:57 AM by 14513 RSS

Read out the WebLogic-Version using Java

875235 Newbie
Currently Being Moderated

I wonder if there is a way to read out the WebLogic-Version during server runtime using Java.

Any help will be appreciated.


  • 1. Re: Read out the WebLogic-Version using Java
    Pierluigi Vernetto Pro
    Currently Being Moderated (it's a bit garbled but still readable)
  • 2. Re: Read out the WebLogic-Version using Java
    RenévanWijk Oracle ACE
    Currently Being Moderated
    An example
    import javax.naming.Context;
    import java.util.Hashtable;
    public class SomeTest {
        private String hostname = "hostname";
        private Integer port = 7001;
        private String username = "username";
        private String password = "password";
        private String protocol = "t3";
        private String jndiRoot = "/jndi/";
        private String mBeanServer = "";
        private String serviceName = "com.bea:Name=DomainRuntimeService,";
        private JMXConnector connector;
        public static void main(String[] args) {
            SomeTest test = new SomeTest();
            try {
                MBeanServerConnection connection = test.getMBeanServerConnection();
            } catch (Exception e) {
        public void getSomeInformation(MBeanServerConnection connection) throws Exception {
            ObjectName service = new ObjectName(serviceName);
            ObjectName[] serverRunTimes = (ObjectName[]) connection.getAttribute(service, "ServerRuntimes");
            for (int i = 0; i < serverRunTimes.length; i++) {
                String name = (String) connection.getAttribute(serverRunTimes, "Name");
    String version = (String) connection.getAttribute(serverRunTimes[i], "WeblogicVersion");
    String state = (String) connection.getAttribute(serverRunTimes[i], "State");
    System.out.println("Server name: " + name + ", Version: " + version + ", Server state: " + state);

    public MBeanServerConnection getMBeanServerConnection() throws IOException {
    return getJmxConnector().getMBeanServerConnection();

    public JMXConnector getJmxConnector() throws IOException {
    JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname, port, jndiRoot + mBeanServer);

    Hashtable hashtable = new Hashtable();
    hashtable.put(Context.SECURITY_PRINCIPAL, username);
    hashtable.put(Context.SECURITY_CREDENTIALS, password);
    hashtable.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "");

    connector = JMXConnectorFactory.connect(serviceURL, hashtable);
    return connector;

    public void closeJmxConnector() throws IOException {
    Note that when using the 't3' protocol the wlfullclient.jar must be in the classpath, otherwise you run into the following exception: Unsupported protocol: t3
    Information to create a wlfullclient.jar can be found here:
    Information regarding runtimeMBean can be found here:
    Open the tree Runtime MBeans, ServerRuntimeMBean and click attributes to see the available attributes (such as Name, WeblogicVersion, State etcetera).
    An example output of the program above:
    Server name: osb_server1, Version: WebLogic Server Fri Apr 9 00:05:28 PDT 2010 1321401 , Server state: RUNNING
    Server name: AdminServer, Version: WebLogic Server Fri Apr 9 00:05:28 PDT 2010 1321401 , Server state: RUNNING
  • 3. Re: Read out the WebLogic-Version using Java
    14513 Newbie
    Currently Being Moderated

    thank you very much for your help.




  • Correct Answers - 10 points
  • Helpful Answers - 5 points