Pages

Sunday, January 16, 2011

ADF JMX Datacontrol in FMW 11g PS3

One of the new Fusion MiddleWare PS3 ADF features is the JMX Datac Control. Back in late 2007 I already blogged about it and now 3 years later, Oracle finally released this feature in Patch Set 3. With the JMX Data Control you can manage your MBeans, read its attributes or invoke its operations. When an attribute gives back an MBean reference then ADF will look up this reference and returns this object. ( This is not the case in the System MBean browser of the Enterprise Manager application. )
I don't think this feature will be used in enduser applications, but can be very useful in support applications so the administrator can control the FMW servers. In this blogpost I will show you how you can use the JMX Data Control to give you a WebLogic Domain overview with its servers and application deployments.

First you need to create a JMX connection.

 Provide the WebLogic connection information
 After the JMX Connection creation, you can add the JMX Data Control to your application
 Select the JMX Connection
Select the MBeans, ( The EM System MBean browser can be handy to find the right MBean ), I will use the domain MBean located in com.bea.Domain
In the Data Controls window you can see my Domain MBean with its attributes and accessors.

 First I drag my Domain MBean to the page and select the attributes I want to show.
I also want to show you the WebLogic servers as child of the Domain ( in table layout ), the same for application deployments. So drag the Servers accessor on the page and select the attributes you want to show.
 With this as result.
Be aware, the JMX Data Control does not  know every Java Object, so if you want to use this on the SOA Suite MBeans it will give you some errors. It can't find the XML presentation of these SOA Java Object.

6 comments:

  1. Hi Edwin,

    Very cool feature. Thanks for showing it. And I will try to find a good use for end users - there has to be a way of making a meaningful application, I am sure...

    kind regards,

    Lucas

    ReplyDelete
  2. Hi Edwin,

    Thanks. Your sample works great. However, when I try to add a user via the createUser() method I get a Null exception, as shown below, even though the user is added. Here is what I am doing:

    1. Under DefaultDomain, SecurityConfiguration, DefaultRealm, AuthenticationProviders, I drag the createUser(...) method to an empty jspx file.
    2. The fields are created for the 3 arguments along with the "create User" button.
    3. When I run it, I get NULL exception at:
    ../JmxDataControl.invokeMBeanOperation(JmxDataControl.java:1189)

    What am I missing here?

    My project requires displaying and managing the users in the embedded LDAP server, including adding and deleting new users, via our WebApp and not the WLS console. The new JMX DataControl seemed perfect for this, but I am running into this exception.

    What is the recommended approach to calling the methods on these MBeans from within ADF? Would you recommend using a Backing Bean instead?

    Regards,
    Lino

    ReplyDelete
  3. The stacktrace(1 of 2) for the createUser() exception.

    Thanks for the help.
    Lino

    ------------
    ServiceURL:service:jmx:t3://localhost:7101/jndi/weblogic.management.mbeanservers.runtime
    ADF: Adding the following JSF error message: java.lang.NullPointerException
    java.lang.NullPointerException
    at oracle.adfinternal.model.adapter.jmx.JmxDataControl.invokeMBeanOperation(JmxDataControl.java:1184)
    at oracle.adfinternal.model.adapter.jmx.JmxDataControl.invokeOperation(JmxDataControl.java:868)
    at oracle.adf.model.bean.DCBeanDataControl.invokeMethod(DCBeanDataControl.java:430)
    at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:261)
    at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1635)
    at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2143)
    at oracle.adf.model.bean.DCBeanDataControl.invokeOperation(DCBeanDataControl.java:467)
    at oracle.adf.model.adapter.AdapterDCService.invokeOperation(AdapterDCService.java:307)
    at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:740)
    at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:394)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:185)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.el.parser.AstValue.invoke(Unknown Source)
    at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
    at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1256)
    at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:765)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:305)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:185)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)

    ReplyDelete
  4. The stacktrace (2 of 2) for createUser().
    ----------
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:175)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)

    ReplyDelete
  5. Dear Edwin ,
    Thank you for the helpful Information
    actually I'm facing some issue wen I used configuration manager, I have a startEdit method which it's takes two parameters waitTimeInMillis, timeOutInMillis when I pass 5000,7000
    It's throws exception






    ADF: Adding the following JSF error message: Cannot create an object of type:javax.management.openmbean.ArrayType from type:[Ljavax.management.openmbean.CompositeData; with value:[Ljavax.management.openmbean.CompositeData;@56d75f
    oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:javax.management.openmbean.ArrayType from type:[Ljavax.management.openmbean.CompositeData; with value:[Ljavax.management.openmbean.CompositeData;@56d75f
    at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:880)
    at oracle.jbo.domain.TypeFactory.getInstance(TypeFactory.java:102)
    at oracle.jbo.server.AttributeDefImpl.convertToJava(AttributeDefImpl.java:2223)
    at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:2135)
    at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1740)
    at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1891)
    at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:834)
    at oracle.adf.model.bean.DCDataRow.getAttributeInternal(DCDataRow.java:405)
    at oracle.jbo.server.ViewRowImpl.getAttrInvokeAccessor(ViewRowImpl.java:916)
    at
    any help I will do appreciated!

    ReplyDelete