WebSphere Application Server - MBean returning user defined types

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Application Server > October 2004 > MBean returning user defined types





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author MBean returning user defined types
Amit Jindal

2004-10-27, 2:50 am

Hi

I have written a Mbean which has an operation that returns a class of my
own. But I get an exception of kind
javax.management.RuntimeOperationsException. Other operations that return
Java data types work fine.

Is there any restriction on what types can be returned by MBean operations?
Or do we have to use underlying SOAP infrastructure to do this. If so, gow
do we access that?

Given below is part of MBeanDescriptor xml file that shows definition of the
function that returns my own class MyPackage.MyClass.

<operation name="getApplication" role="operation" type="MyPackage.MyClass"
targetObjectType="objectReference" impact="action">
<signature>
<parameter name="applName" type="java.lang.String"/>
</signature>
</operation>

Regards
Amit



Ken Hygh

2004-10-27, 7:48 am

Amit Jindal wrote:

>Hi
>
>I have written a Mbean which has an operation that returns a class of my
>own. But I get an exception of kind
>javax.management.RuntimeOperationsException. Other operations that return
>Java data types work fine.
>
>Is there any restriction on what types can be returned by MBean operations?
>Or do we have to use underlying SOAP infrastructure to do this. If so, gow
>do we access that?
>
>Given below is part of MBeanDescriptor xml file that shows definition of the
>function that returns my own class MyPackage.MyClass.
>
><operation name="getApplication" role="operation" type="MyPackage.MyClass"
>targetObjectType="objectReference" impact="action">
> <signature>
> <parameter name="applName" type="java.lang.String"/>
> </signature>
></operation>
>
>Regards
>Amit
>
>
>
>
>

Part of the issue here is the classloader that has MyPackage.MyClass. It
has to be visible from the same classloader as the MBean.

For example, if you MBean is loaded as a Custom Service, but
MyPackage.MyClass (or any supertype) is in your EAR file, you'll get an
error.

AFAIK there's no limitation on the types, but they may need to be
Serializable

Ken
Amit Jindal

2004-10-27, 7:48 am

Thanks Ken for your reply.

My MBean is a part of an EAR which contains MyPackage. Doesn't then both of
them become visible to the same loader.

My MBean is a Model MBean. And I have made MyClass Serializable, but still
getting the same error.

Regards
Amit

"Ken Hygh" <kenhygh@nc.rr.com> wrote in message
news:clnu8r$8jnq$1@news.boulder.ibm.com...
> Amit Jindal wrote:
>
operations?[vbcol=seagreen]
gow[vbcol=seagreen]
the[vbcol=seagreen]
type="MyPackage.MyClass"[vbcol=seagreen]
> Part of the issue here is the classloader that has MyPackage.MyClass. It
> has to be visible from the same classloader as the MBean.
>
> For example, if you MBean is loaded as a Custom Service, but
> MyPackage.MyClass (or any supertype) is in your EAR file, you'll get an
> error.
>
> AFAIK there's no limitation on the types, but they may need to be
> Serializable
>
> Ken



Brian J. Sayatovic

2004-10-27, 7:48 am

Just because two classes are in the same EAR doesn't mean they're loaded by
the same classloader. Depending on how you have your module visiblity and
what not set up, there may be one class loader for an EAR, or several in a
parent-child relationship.

Regards,
Brian.

"Amit Jindal" <amit_jindal@persistent.co.in> wrote in message
news:clnv3q$55hg$1@news.boulder.ibm.com...
> Thanks Ken for your reply.
>
> My MBean is a part of an EAR which contains MyPackage. Doesn't then both

of
> them become visible to the same loader.
>
> My MBean is a Model MBean. And I have made MyClass Serializable, but still
> getting the same error.
>
> Regards
> Amit
>
> "Ken Hygh" <kenhygh@nc.rr.com> wrote in message
> news:clnu8r$8jnq$1@news.boulder.ibm.com...
my[vbcol=seagreen]
return[vbcol=seagreen]
> operations?
> gow
of[vbcol=seagreen]
> the
> type="MyPackage.MyClass"
>
>



Amit Jindal

2004-10-27, 7:48 am

I got it working by putting the JAR with all the files in lib folder of WAS.

I am still not totally clear about Classloader issue and how can it be
resolved.

Thanks a lot anyway for your help...

Amit

"Brian J. Sayatovic" <bsayatovic@amig.com> wrote in message
news:clo107$6it4$1@news.boulder.ibm.com...
> Just because two classes are in the same EAR doesn't mean they're loaded

by
> the same classloader. Depending on how you have your module visiblity and
> what not set up, there may be one class loader for an EAR, or several in a
> parent-child relationship.
>
> Regards,
> Brian.
>
> "Amit Jindal" <amit_jindal@persistent.co.in> wrote in message
> news:clnv3q$55hg$1@news.boulder.ibm.com...
> of
still[vbcol=seagreen]
> my
> return
so,[vbcol=seagreen]
> of
It[vbcol=seagreen]
an[vbcol=seagreen]
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com