AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pb on using Custom Mbeans in WebSphere6

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Software Tools
View previous topic :: View next topic  
Author Message
blured
Guest





PostPosted: Wed Oct 26, 2005 1:45 pm    Post subject: Pb on using Custom Mbeans in WebSphere6 Reply with quote



Hi,

I'm trying to use a MBean I've made inside WAS6. However I've got the
error
message :
<<
javax.management.RuntimeOperationsException: The "name" parameter
cannot be
null. nested runtime exception is java.lang.IllegalArgumentException:
The "name"
parameter cannot be null.
Quote:


The JAR containing the MBean is installed through the admin console via

"server1 > Admin Services > Extension MBean Provider".

The MBean is accessed via a test servlet.

Is it a normal way to create a customized mbean in WAS 6 ? Why cannot I
see the MBean in the console (text based or mbeaninspector from
developerworks) ?

Bellow are code used in the various components.

Hope somebody already used custom made mbeans in WebSphere and will be
able to answer my question.

Regards,
Blured75.



Here is the xml file used :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MBean SYSTEM "MbeanDescriptor.dtd">
<MBean type="DBOTestMBean">
<operation name="startService" role="operation"
targetObjectType="objectReference" type="void">
<signature/>
</operation>
</MBean>

Here is the java class implementing the mbean :
<<
package com.dbo.test;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.ibm.websphere.management.JMXManageable;

public class DBOTestMBeanImpl implements JMXManageable, DBOTestMBean
{

// CustomService methods
public void initialize(Properties props) throws Exception
{
System.out.println("DBOTestMBeanImpl.initialize("+props+")");
startService();
}
public void shutdown()
{
System.out.println("DBOTestMBeanImpl.shutdown()");
}

public void startService() {
System.out.println("begin DBOTestMBeanImpl.startService()");

try {
Context ctx = new InitialContext();
System.out.println("in the startservice of DBOTestMBeanImpl.java
!");

}
catch (Exception ex) {
ex.printStackTrace();
}
System.out.println("end DBOTestMBeanImpl.startService()");
}

// JMXManageable methods
public String getType()
{
System.out.println("DBOTestMBeanImpl.getType()"); return
"DBOTestMBean";
}
public Properties getMBeanProperties()
{
System.out.println("DBOTestMBeanImpl.getMBeanProperties()");
Properties props = new Properties();
props.put("Identification", "DBOTestMBean");
return props;
}
}
Quote:


Here is the interface used :
<<
package com.dbo.test;
/**
* MBean interface.
*/
public interface DBOTestMBean {
public void startService();
}
Quote:


Here is the code snippet from the servlet used to call the MBean :
<<
MBeanFactory mbfactory = AdminServiceFactory.getMBeanFactory();
System.out.println("before");

//mbfactory.

mbfactory.completeActivateMBeans();

List aList = mbfactory.getMBeanTypes();
Iterator itList = aList.iterator();
while (itList.hasNext()) {
System.out.println("itList.next() " + itList.next());
}


ObjectName on2 = null;

try {
on2 = new
ObjectName("WebSphere:cell=websphereNode02Cell,mbeanIdentifier=DBOTestMBean,name=DBOTestMBean,node=websphereNode02,process=server1,type=DBOTestMBean,version=6.0.2.1");
}
catch (Exception ex) {
System.out.println("Exception sur la création de l'object name
DBO Test MBean");
ex.printStackTrace();
}

String opName = "startService";
String signature[] = { };
String params[] = { };
try
{
AdminServiceFactory.getAdminService().invoke(on2, opName, params,
signature);
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception invoking launchProcess: " + e);

}
Quote:



Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Software Tools All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.