cancel
Showing results for 
Search instead for 
Did you mean: 

Registering MBean in Dispatcher node

Former Member
0 Kudos

Hi All,

I am trying to figure out a way to register a

customized StandardMBean in all cluster nodes.

Unfortunately I don't manage to register my mbean in

dispatcher MBeanServer as it doesn't have the MBean classloader.

Currently I am registering the MBeans from a servlet so

the server classloader is aware of the MBean (it is

deployed together with the servlet in the EAR file), but

the dispatcher node isn't.

I am using javax.management.MBeanServerConnection to

obtain connection to the remote MBean server.

Then I am using the createMBean(..) method to istantiate

and register the MBean in the remote MBeanServer.

Could someone give me a hint how to add my MBean to the

dispatcher classloader. Any alternatives will be also

appreciated.

This is the exception I get when trying to register the

MBean in the dispatcher MBeanServer:

com.sap.engine.services.jmx.exception.JmxConnectorException:

Unable to de-serialize request parameters, message [ JMX request

(java) v1.0 len: 323 | src: cluster target-node: 505798100 req:

createMBean(S,ON,ON) params-number: 3 params-bytes: 0 | com.abc.jmx.MyMBean :name=MyName,j2eeType=ABC_MyType,SAP_J2EEClusterNode=505798100,SAP_J2EECluster=""

:name="abc.com/MyLoader",j2eeType=SAP_J2EEClassLoader,SAP_J2EEClusterNode="",SAP_J2EECluster="" ] at

com.sap.engine.services.jmx.RequestMessage.readParams(RequestMessage.java:526) at

com.sap.engine.services.jmx.RequestMessage.getParams(RequestMessage.java:575) at

com.sap.engine.services.jmx.MBeanServerInvoker.invokeMbs(MBeanServerInvoker.java:106) at

com.sap.engine.services.jmx.JmxServiceConnectorServer.receiveWait(JmxServiceConnectorServer.java:173) at com.sap.engine.core.service630.context.cluster.message.MessageListenerWrapper.process(MessageListenerWrapper.java:81) at

com.sap.engine.core.cluster.impl6.ms.MSListenerThread.run(MSListenerThread.java:47) at

com.sap.engine.frame.core.thread.Task.run(Task.java:60)

at com.sap.engine.core.thread.impl6.SingleThread.execute(SingleThread.java:72) at

com.sap.engine.core.thread.impl6.SingleThread.run(SingleThread.java:142) <b>Caused by:

javax.management.InstanceNotFoundException: ClassLoader with name :name="abc.com/MyLoader",j2eeType=SAP_J2EEClassLoader,SAP_J2EEClusterNode="",SAP_J2EECluster="" not found in repository at com.sap.engine.services.jmx.CompletionInterceptor.getClassLoader(CompletionInterceptor.java:556)</b> at com.sap.engine.services.jmx.RedirectInterceptor.getClassLoader(RedirectInterceptor.java:493) at

com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.getClassLoader(MBeanServerInterceptorChain.java:435) at com.sap.engine.services.jmx.RequestMessage.readParams

(RequestMessage.java:515) ... 8 more -


predecessor system -


com.sap.engine.services.jmx.exception.JmxConnectorException: Unable to de-serialize request parameters, message

[ JMX request (java) v1.0 len: 323 | src: cluster target-node: 505798100 req: createMBean(S,ON,ON)

params-number: 3 params-bytes: 0 | com.abc.jmx.MyMBean :name=MyName,j2eeType=ABC_MyType,SAP_J2EEClusterNode=505798100,SAP_J2EECluster=""

:name="abc.com/MyLoader",j2eeType=SAP_J2EEClassLoader,SAP_J2EEClusterNode="",SAP_J2EECluster="" ] at com.sap.engine.services.jmx.MBeanServerConnectionImpl.invokeMbsInternal(MBeanServerConnectionImpl.java:677) at com.sap.engine.services.jmx.MBeanServerConnectionImpl.createMBean(MBeanServerConnectionImpl.java:105) at

com.sap.engine.services.jmx.MBeanServerConnectionSecurityWrapper.createMBean(MBeanServerConnectionSecurityWrapper.java:95) at ...

Dan

Message was edited by: Dan Sobol

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I don’t think SAP has intended customers to register custom mbeans in the dispatcher node. This is probably the reason that there is no documentation in regard. Anyway with some common sense and creativeness I found the way.

<b>1)</b>

First think you want to deploy your mbean so a class loader of your mbean class is available in all the cluster nodes including dispatcher nodes. In order to accomplish this you’ll have to:

<b>a.</b> Implement your mbean and archive it in a jar file.

<b>b.</b> Create a Library J2EE Server component. File ---> new --> other --> J2EE Server Component --> Library

<b>c.</b> Use the privder.xml wizard to add your jar created in (a) to the library project.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE provider-descriptor SYSTEM "library.provider.dtd">

<provider-descriptor>

<display-name>XxxLib</display-name>

<component-name>XxxLib</component-name>

<major-version>6</major-version>

<minor-version>40</minor-version>

<micro-version>0</micro-version>

<provider-name>xxx.com</provider-name>

<references>

<reference provider-name="sap.com" strength="weak" type="library">tc/jmx</reference>

<reference provider-name="sap.com" strength="weak" type="library">com.sap.tc.Logging</reference>

<reference provider-name="sap.com" strength="weak" type="library">core_lib</reference>

</references>

<jars>

<jar-name>mbeanjar.jar</jar-name>

</jars>

</provider-descriptor>

<b>d.</b> Now the tricky part:

The current library project structure as created by the Netweaver IDE is

ProjectName

META-INF

sda-dd.xml

server

provider.xml

In order to deploy the mbean to the dispatcher node you need to create another folder named dispatcher and copy the provider.xml to it.

ProjectName

META-INF

sda-dd.xml

server

provider.xml

dispatcher

provider.xml

<b>e.</b> Create a deployable .sda archive from the library project.

<b>f.</b> Deploy the sda archive.

<b>g.</b> Check if the mbean class loader has been added to all cluster nodes. Go to visual admin Services --> Class Loader Viewer --> Libraries and check if the mbean class loader exists e.g. library:com.xxx~libname.

<b>2)</b>

Once a class loader of your mbean implementation exists in all nodes it is straightforward how to actually register the mbean.

<b>…</b>

MBeanServer mbs = (MBeanServer) initCtx.lookup("jmx");

mbs.createMBean(<i>mbeanClassName</i>, <i>objectName</i>, <i>classLoaderObjectName</i>);

<b>Where:</b>

mbeanClassName is the mbean class full qualified name e.g. com.xxx.mbean.ClassName

objectName is the mbean object name. You may create it by using ObjectNameFactory.getNameForServerChildPerNode(<i>j2eeType</i>, <i>name</i>, <i>nodeId</i>, null);

classLoaderObjectName is the mbean's class loader object name: You may create it using ObjectNameFactory.getNameForClassLoader(<i>libraryName</i>, null, null);

Hopefully I didn’t miss anything substantial.

Have fun

Former Member
0 Kudos

Hello Dan

Amazing, this was in 2005.

Do you still remember how createMBean works? There is an article here, but at the end it does not explain how to get or create the class loader.

https://help.sap.com/saphelp_nwpi711/helpdata/en/04/140e08a848314cac9dbd05750c3de5/content.htm

The explanation there '...assuming the class is loaded by the class loader of...' is insufficient. In your article you are mentioning 'the MBean class loader'. What is that exactly?

By the way, I don't care about the dispatchers, just the servers.

Greetings

Pantelis

Former Member
0 Kudos

Hi,

Did you find any solution?

Best regards

Former Member
0 Kudos

Not yet,

Former Member
0 Kudos

Hi,

I am facing the same issue. Could you please advice what is the solution?

Thanks and Regards,