MBean invoke operations question - Websphere
This is a discussion on MBean invoke operations question - Websphere ; Hi to All,
I have a question to invokation of MBean operations,
I use the alphaworks MBeaninspector to view my MBeans in WAS 5.1. I have
created a MBean according to the some IBM developerWorks article.
code comes here:
public ...
-
MBean invoke operations question
Hi to All,
I have a question to invokation of MBean operations,
I use the alphaworks MBeaninspector to view my MBeans in WAS 5.1. I have
created a MBean according to the some IBM developerWorks article.
code comes here:
public class LoginRestrictor extends RuntimeCollaborator {
private static Map m_loginRestrictions=new HashMap();
/**
*
*/
public LoginRestrictor() {
}
public static boolean isLoginAllowed(String role){
Boolean loginAllowed=(Boolean) m_loginRestrictions.get
(role);
if (loginAllowed!=null){
return loginAllowed.booleanValue();
}else{
return true;
}
}
public static void setLoginAllowed(String role,boolean isAllowed){
Boolean allowed=new Boolean(isAllowed);
m_loginRestrictions.put(role,allowed);
}
}
------MBeanDescriptor is here:-----------------
collaboratorClass="com.hpigmbh.efleet.presentation.util.actionUtils.L ogi
nRestrictor" >
targetObjectType="objectReference" impact="INFO" >
targetObjectType="objectReference" impact="ACTION">
Activation of my Bean is done here:
public class LoginRestrictorManager {
/**
*
*/
public LoginRestrictorManager() {
System.out.println("LoginRestrictorManager constructor");
System.out.println("LoginRestrictorManager start");
MBeanFactory mbfactory=AdminServiceFactory.getMBeanFactory
();
RuntimeCollaborator collab=new LoginRestrictor();
try {
mbfactory.activateMBean
("LoginRestrictorMBean",collab,"LoginRestrictorMBeanId","com//hpigmbh//e
fleet//presentation//util//actionUtils//LoginRestrictorMBean.xml");
} catch (AdminException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("LoginRestrictorManager end");
}
}
All is packed in a Webproject and runs fine, but....
with the wsadmin tool I can invoke the isLoginAllowed Method, I assume I
cannot invoke setLoginAllowed because I don't know how to pass the
boolean value as a String, wsadmin tells me it don't find the operation.
In the mbeaninspector I see my MBean but all operations are not
invokable. The same is true for other MBeans contained in WAS e.g. I can
invoke getJavaVersion from MBean JVM but not getProperty. Does someone
know how to get the operations invokable?? Seems like I cannot invoke
operations that have parameters to pass.
Help Appreciated,
Thanks Thomas
-
Re: MBean invoke operations question
Thomas Hollfelder wrote:
>Hi to All,
>
>I have a question to invokation of MBean operations,
>
>I use the alphaworks MBeaninspector to view my MBeans in WAS 5.1. I have
>created a MBean according to the some IBM developerWorks article.
>
>code comes here:
>
>
>
>
[snip]
>All is packed in a Webproject and runs fine, but....
>with the wsadmin tool I can invoke the isLoginAllowed Method, I assume I
>cannot invoke setLoginAllowed because I don't know how to pass the
>boolean value as a String, wsadmin tells me it don't find the operation.
>
>In the mbeaninspector I see my MBean but all operations are not
>invokable. The same is true for other MBeans contained in WAS e.g. I can
>invoke getJavaVersion from MBean JVM but not getProperty. Does someone
>know how to get the operations invokable?? Seems like I cannot invoke
>operations that have parameters to pass.
>
>Help Appreciated,
>
>Thanks Thomas
>
>
>
try right-clicking on the operation name and select 'invoke'
Ken
-
Re: MBean invoke operations question
Ken Hygh wrote in news:d36m7v$373g$1
@news.boulder.ibm.com:
> Thomas Hollfelder wrote:
>
>>Hi to All,
>>
>>I have a question to invokation of MBean operations,
>>
>>I use the alphaworks MBeaninspector to view my MBeans in WAS 5.1. I have
>>created a MBean according to the some IBM developerWorks article.
>>
>>code comes here:
>>
>>
>>
>>
> [snip]
>
>>All is packed in a Webproject and runs fine, but....
>>with the wsadmin tool I can invoke the isLoginAllowed Method, I assume I
>>cannot invoke setLoginAllowed because I don't know how to pass the
>>boolean value as a String, wsadmin tells me it don't find the operation.
>>
>>In the mbeaninspector I see my MBean but all operations are not
>>invokable. The same is true for other MBeans contained in WAS e.g. I can
>>invoke getJavaVersion from MBean JVM but not getProperty. Does someone
>>know how to get the operations invokable?? Seems like I cannot invoke
>>operations that have parameters to pass.
>>
>>Help Appreciated,
>>
>>Thanks Thomas
>>
>>
>>
> try right-clicking on the operation name and select 'invoke'
>
> Ken
Uh, no chance..., it's grayed out.
I found in the alphaworks FAQ for mbeansinpector the following:
http://www.alphaworks.ibm.com/tech/m...spector/faq#01
1. I want to call an MBean operation, but the Invoke menu item for my
desired operation is greyed-out -- why?
The operation you are trying to invoke expects an unsupported data type
as a parameter. MBeanInspector knows how to provide many commonly used
data types, but not all.
The unsupported DataType seems to be a java.lang.String ?????
As I use WSAD 5.1.2 with WAS 5.1 it may be a compilation problem? I know
that mbeaninspector was working fine with the 5.0 version.
Thomas
-
Re: MBean invoke operations question
I did a complete reinstall of the mbeaninspector and now it works.
>> try right-clicking on the operation name and select 'invoke'
>>
>> Ken
>
> Uh, no chance..., it's grayed out.
> I found in the alphaworks FAQ for mbeansinpector the following:
> http://www.alphaworks.ibm.com/tech/m...spector/faq#01
>
>
> 1. I want to call an MBean operation, but the Invoke menu item for my
> desired operation is greyed-out -- why?
>
> The operation you are trying to invoke expects an unsupported data
> type as a parameter. MBeanInspector knows how to provide many
> commonly used data types, but not all.
>
>
> The unsupported DataType seems to be a java.lang.String ?????
>
> As I use WSAD 5.1.2 with WAS 5.1 it may be a compilation problem? I
> know that mbeaninspector was working fine with the 5.0 version.
>
>
> Thomas
>