users@glassfish.java.net

Re: Management rule & MBean

From: Pankaj Jairath <Pankaj.Jairath_at_Sun.COM>
Date: Fri, 20 Jun 2008 16:31:31 +0530

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
>
>