I tried mc4j and still ran into the same exception. This is leading me to believe that this is not a jmanage issue.
I emailed my web application and source code to a developer from jmanage who ran into the same exception when deploying the application on weblogic 8.1 sp4. The following is a quote from the message he sent me:
I spent some time on this issue, but couldn't resolve it. It is either an issue with the
JMX remote API that weblogic provides, or with the spring framework.
I also tried using MC4J (another JMX console), and it has the same issue.
There is also something weird with spring JMX exporter. It exports the get
method both as an attribute and as an operation. When attribute's value
is queried, it doesn't returns nothing. This seems like a bug in spring.
My application context looks like:
Code:
<beans>
<bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="log4j:name=settings" value-ref="log4jBean"/>
</map>
</property>
<property name="server">
<ref bean="mbeanServer"/>
</property>
</bean>
<bean id="log4jBean" class="org.kbaum.log4j.Log4jConfig"/>
<bean id="mbeanServer"
class="org.kbaum.weblogic.jmx.WeblogicMBeanServerFactoryBean"/>
</beans>
My java code:
Code:
public class Log4jConfig {
public void setLogger(String category, String level) {
LogManager.getLogger(category).setLevel(Level.toLevel(level));
}
public String getLog4jProperties() {
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
new PropertyPrinter(printWriter);
printWriter.flush();
return writer.toString();
}
}
Code:
public class WeblogicMBeanServerFactoryBean implements FactoryBean, InitializingBean {
private MBeanServer server;
public Object getObject() throws Exception {
return server;
}
public Class getObjectType() {
return MBeanServer.class;
}
public boolean isSingleton() {
return true;
}
public void afterPropertiesSet() throws Exception {
MBeanHome mBeanHome = (MBeanHome) new JndiTemplate().lookup(MBeanHome.LOCAL_JNDI_NAME);
server = mBeanHome.getMBeanServer();
}
}
If there is anything in the above configuration and java code that looks wrong, please let me know.
Thanks.
-karl