Results 1 to 7 of 7

Thread: JMX sample on Weblogic 8.1sp3

  1. #1
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default JMX sample on Weblogic 8.1sp3

    I am using the following software:
    Weblogic 8.1sp3
    Spring 1.2.1
    MC4J 1.2beta9
    Java 1.4.2_09

    I have deployed the same MBean example from the Reference Manual. The problem is the MBeans don't seem to operate as I expect. MC4J says the attributes Age and Name "<cannot display>" where I expect to have their values of 10 and "Bill" to be displayed. I get something similar when I use jmx-browser 1.2.0, the values of those properties are null. Adding an interface and using org.springframework.jmx.export.assembler.Interface BasedMBeanInfoAssembler doesn't seem to help either. Has anyone else used this combination of software?

    Here are my files:

    appContext.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
      <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
        <property name="beans">
          <map>
            <entry key="bean&#58;name=testBean1">
              <ref local="testBean"/>
            </entry>
          </map>
        </property>
        <property name="server">
          <bean class="org.springframework.jmx.support.WebLogicMBeanServerFactoryBean">
            <property name="username"><value>system</value></property>
            <property name="password"><value>weblogic</value></property>
            <property name="serverName"><value>myserver</value></property>
            <property name="serverUrl"><value>t3&#58;//localhost&#58;7001/</value></property>
          </bean>
          </property>
      </bean>
    
      <bean id="testBean" class="testjmx.MyApp">
        <property name="age"><value>10</value></property>
        <property name="name"><value>Bill</value></property>
      </bean>
    </beans>
    Startup class:
    Code:
    public class TestStartup implements T3StartupDef &#123;
      public String startup&#40;String parm1, Hashtable parm2&#41; throws java.lang.Exception &#123;
        System.out.println&#40;"TestStartup STARTING UP"&#41;;
          ClassPathXmlApplicationContext ctx = new
              ClassPathXmlApplicationContext&#40;"testjmx/appContext.xml"&#41;;
          MyApp bean = &#40;MyApp&#41;ctx.getBean&#40;"testBean"&#41;;
        System.out.println&#40;"Name=" + bean.getName&#40;&#41; + ", Age=" + bean.getAge&#40;&#41;&#41;;
        System.out.println&#40;"TestStartup DONE"&#41;;
        return "Spring Startup Complete";
      &#125;
      public void setServices&#40;T3ServicesDef parm1&#41; &#123;
    
      &#125;
    &#125;
    Java class:
    Code:
    public class MyApp &#123;
      private String name;
    
      private int age;
    
      private boolean isSuperman;
    
      public int getAge&#40;&#41; &#123;
          return age;
      &#125;
    
      public void setAge&#40;int age&#41; &#123;
          this.age = age;
      &#125;
    
      public void setName&#40;String name&#41; &#123;
          this.name = name;
      &#125;
    
      public String getName&#40;&#41; &#123;
          return name;
      &#125;
    
      public int add&#40;int x, int y&#41; &#123;
          return x + y;
      &#125;
    
      public void dontExposeMe&#40;&#41; &#123;
          throw new RuntimeException&#40;&#41;;
      &#125;
    
    &#125;

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    I remember a similar post with MC4j working on jdk 1.5 but not on 1.4 - I think the similar problem occured. Try to find a different jmx console - a servlet - or try connecting with the jconsole from jdk 1.5 from a different machine and see if the problem is with mc4j or Spring itself.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    I have a similar problem when using wlshell. The error displayed when trying to retrieve the attributes is:

    error: An exception occured while trying to get an attribute value: The target object class class javax.management.modelmbean.ModelMBeanOperationInf o could not be found

    I've upgraded to Weblogic 8.1sp4 and Spring 1.2.5.

  4. #4
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    I also noticed that my bean exported shows up in a "bean" section of the console, as expected. But underneath that top level instead of seeing my bean, I see the following:

    Code:
    - bean
      +-typeless
         +-testBean1
    How would I configure it so it looks like this:

    Code:
    - bean
      +-testBean1

  5. #5
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    I recall some posts about this - I think it was also an issue raised on JIRA. Please search the forum for more info - I think Rob is planning to fix this in 1.3 (if it's not already fixed in 1.2.6).
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  6. #6
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    Looking at SPR-1395, I did get this partially resolved. Setting the exposeClassDescriptor property on my assembler now shows the Name property. But the Age property still doesn't show.

    In MC4J the error message when I show the properties of the Age attribute is: "Type is unkown and can't be displayed"

    In wlshell I get: "An exception occured while trying to get an attribute value: int"

    Also, the bean is still showing in wlshell as "typeless"

  7. #7
    Join Date
    Nov 2005
    Posts
    1

    Default

    you might want to try the newest version of wlshell (2.1.0-beta-2) at http://www.wlshell.net/beta/index.html

    if the JMX name of the mbean is:
    bean:name=testBean1

    then configure wlshell to use "name" as the key path with the command:

    path name

    and you'll get:

    bean:/testBean1

    see:
    http://www.wlshell.net/beta/directories.html
    http://www.wlshell.net/beta/commands.html#path

    hope this helps,
    Paco

Similar Threads

  1. Container Adapter for Weblogic
    By jeantine in forum Security
    Replies: 2
    Last Post: Aug 24th, 2006, 06:22 PM
  2. Replies: 1
    Last Post: Sep 17th, 2005, 02:19 AM
  3. Can't find the configuration file in WebLogic...
    By anagnost68 in forum Container
    Replies: 1
    Last Post: Sep 8th, 2005, 01:00 AM
  4. Replies: 2
    Last Post: May 26th, 2005, 02:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •