users@glassfish.java.net

Re: Management rule & MBean

From: Shalini Muthukrishnan <Shalini.Muthukrishnan_at_Sun.COM>
Date: Mon, 23 Jun 2008 11:22:59 +0530

Hi,

 From the domain.xml, it looks like the management rule has been created
only for DAS (or server-config) and not for the cluster1-config or
instance1-config. The mbeans DummyMBean and SendMailActionMbean are
enabled in the application-ref only for server-config and not in the
instance or cluster config. And hence the messages in server.log :
MBeans from server instance instance1 cannot be cascaded.

Could you try to invoke this rule only from the DAS and see if this works?
Also, please edit your domain.xml - under the element <management-rule>
<property name="event" value="ready"/>

should have been

<property name="name" value="ready"/>

After editing domain.xml, restart your domain and see if the rule is
invoked.

HTH,
Shalini.

?? ? wrote:
> Hello,
>
> I attach domain.xml file.
>
> Susumu Majima
>
>
>
>> -----Original Message-----
>> From: Shalini.Muthukrishnan_at_Sun.COM
>> [mailto:Shalini.Muthukrishnan_at_Sun.COM]
>> Sent: Monday, June 23, 2008 2:10 PM
>> To: users_at_glassfish.dev.java.net
>> Subject: Re: Management rule & MBean
>>
>> Hello,
>>
>> Could you attach the domain.xml configuration file so we can
>> look closer into where exactly the problem lies.
>>
>> Thanks,
>> Shalini.
>>
>> ?? ? wrote:
>>
>>> I use GlassFish V2UR2. I can't find management-enevt.
>>> I attach server.log with this mail.
>>>
>>> Thanks,
>>>
>>> Susumu
>>>
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Pankaj.Jairath_at_Sun.COM [mailto:Pankaj.Jairath_at_Sun.COM]
>>>> Sent: Friday, June 20, 2008 8:02 PM
>>>> To: users_at_glassfish.dev.java.net
>>>> Subject: Re: Management rule & MBean
>>>>
>>>> Also do attach the server.log (ensure you have these
>>>>
>> captured for a
>>
>>>> clean /fresh run). I suppose you have set the
>>>>
>> management-event=finest
>>
>>>> as well.
>>>>
>>>> regards
>>>> Pankaj
>>>>
>>>> ?? ? wrote:
>>>>
>>>>
>>>>>
>>>>> Hello,
>>>>>
>>>>> I set "javax.enterprise.system.core.selfmanagement" log
>>>>>
>>>>>
>>>> level finest.
>>>>
>>>>
>>>>> I start domain but there is no evidence for fireing
>>>>>
>>>>>
>>>> lifecycle events.
>>>>
>>>>
>>>>> Does anyone try to kick Custom MBean by lifecycle event?
>>>>>
>>>>> Susumu
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Pankaj.Jairath_at_Sun.COM [mailto:Pankaj.Jairath_at_Sun.COM]
>>>>>> Sent: Thursday, June 19, 2008 6:41 PM
>>>>>> To: users_at_glassfish.dev.java.net
>>>>>> Subject: Re: Management rule & MBean
>>>>>>
>>>>>> First thing would be validate that you have got the event
>>>>>>
>>>>>>
>>>> and action
>>>>
>>>>
>>>>>> invocation working. Could you change the logs service level for
>>>>>> self-management and management-event to fine/finest. Check
>>>>>>
>>>>>>
>>>> if you are
>>>>
>>>>
>>>>>> able to see the lifecycle event being fired. Also verify
>>>>>>
>>>>>>
>>>> the addition
>>>>
>>>>
>>>>>> of this rule binding by the self management service.
>>>>>>
>>>>>> regards
>>>>>> Pankaj
>>>>>>
>>>>>> ?? ? wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hello Forks,
>>>>>>>
>>>>>>> I'm tryimg to set up management rules.
>>>>>>>
>>>>>>> I write MBean interface and MBean listed below.
>>>>>>>
>>>>>>> package asap.action;
>>>>>>>
>>>>>>> public interface SendMailActionMBean {
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> package asap.action;
>>>>>>>
>>>>>>> import java.util.Date;
>>>>>>> import java.util.Properties;
>>>>>>> import java.util.logging.Logger;
>>>>>>>
>>>>>>> import javax.mail.Session;
>>>>>>> import javax.mail.Transport;
>>>>>>> import javax.mail.internet.InternetAddress;
>>>>>>> import javax.mail.internet.MimeMessage; import
>>>>>>> javax.management.Notification; import
>>>>>>> javax.management.NotificationListener;
>>>>>>>
>>>>>>> import javax.mail.Message;
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> public class SendMailAction implements SendMailActionMBean,
>>>>>>> NotificationListener {
>>>>>>>
>>>>>>> @Override
>>>>>>> public void handleNotification(Notification
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> notification, Object handback) {
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Logger log = Logger.getLogger("SendMailAction");
>>>>>>> log.info("SendMailAction");
>>>>>>>
>>>>>>> try {
>>>>>>> Properties props =
>>>>>>>
>> System.getProperties();
>>
>>>>>>> // set SMTP address
>>>>>>> props.put("mail.smtp.host","localhost");
>>>>>>> Session session =
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> Session.getDefaultInstance(props, null);
>>>>>>
>>>>>>
>>>>>>
>>>>>>> MimeMessage mimeMessage = new
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> MimeMessage(session);
>>>>>>
>>>>>>
>>>>>>
>>>>>>> // send from
>>>>>>> mimeMessage.setFrom(
>>>>>>> new
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> InternetAddress("glasssfish_at_lab-wtomcat102d.db.xxxx.co.jp",
>>>>>> "glassfish", "iso-2022-jp"));
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> mimeMessage.setRecipients(Message.RecipientType.TO,
>>>>>> "susumu.majima_at_mail.xxxx.co.jp");
>>>>>>
>>>>>>
>>>>>>
>>>>>>> mimeMessage.setHeader("Content-type",
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> "text/plain");
>>>>>>
>>>>>>
>>>>>>
>>>>>>> mimeMessage.setSubject("Message from
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> GlassFish", "iso-2022-jp");
>>>>>>
>>>>>>
>>>>>>
>>>>>>> mimeMessage.setText("This is
>>>>>>>
>> send by MBean");
>>
>>>>>>> mimeMessage.setSentDate(new Date());
>>>>>>> Transport.send(mimeMessage);
>>>>>>> } catch (Exception ex) {
>>>>>>> ex.printStackTrace();
>>>>>>> }
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> I change parts of my company name to xxxx.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I registered it by asadmin create-mbean command.
>>>>>>> I create a management rule by admin console.
>>>>>>>
>>>>>>> Rule Name:LifeCycleRule
>>>>>>> Event Type:lifecycle
>>>>>>> Event:ready
>>>>>>> Action:SendMailActionBean(It's I registred)
>>>>>>>
>>>>>>> I start up domain but nothing happen. No log,No mail I recieved.
>>>>>>>
>>>>>>> Does someone try to this kind of management rule ?
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Susumu Majima
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>> ---------------------------------------------------------------------
>>
>>>>
>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>>>>> For additional commands, e-mail:
>>>>>>>
>> users-help_at_glassfish.dev.java.net
>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>> ---------------------------------------------------------------------
>>
>>>>
>>>>
>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>>>> For additional commands, e-mail:
>>>>>>
>> users-help_at_glassfish.dev.java.net
>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>> ---------------------------------------------------------------------
>>
>>>>
>>>>
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>>
>>>>>
>>>>>
>>>>>
>> ---------------------------------------------------------------------
>>
>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>
>>>>
>>>>
>>>>
>> ---------------------------------------------------------------------
>>
>>>> ---
>>>>
>>>>
>>>>
>> ---------------------------------------------------------------------
>>
>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net