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
Startup class:Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter"> <property name="beans"> <map> <entry key="bean: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://localhost: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>
Java class:Code:public class TestStartup implements T3StartupDef { public String startup(String parm1, Hashtable parm2) throws java.lang.Exception { System.out.println("TestStartup STARTING UP"); ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("testjmx/appContext.xml"); MyApp bean = (MyApp)ctx.getBean("testBean"); System.out.println("Name=" + bean.getName() + ", Age=" + bean.getAge()); System.out.println("TestStartup DONE"); return "Spring Startup Complete"; } public void setServices(T3ServicesDef parm1) { } }
Code:public class MyApp { private String name; private int age; private boolean isSuperman; public int getAge() { return age; } public void setAge(int age) { this.age = age; } public void setName(String name) { this.name = name; } public String getName() { return name; } public int add(int x, int y) { return x + y; } public void dontExposeMe() { throw new RuntimeException(); } }


Reply With Quote