こんにちは最近、JMX Beanの実装を開始しました。JMXが通知を発行したときにjava.io.NotSerializableExceptionが発生しました
次に、以下のBeanを公開し、JConsoleを実行し、Beanに接続し、通知用に登録します。
4月13日、 WARNING NotifFetcher.fetchOneNotif 2012五時31分26秒PMのClientNotifForwarder:通知をデシリアライズに失敗しました:java.io.NotSerializableException:COMただし、通知が送信されたとき、私は次のエラーを取得します。 * .jmx.TaskMergeMBean
すべてのヘルプは大歓迎だろう、私はこの1つを把握しようと、一日の大半を費やしてきました。
おかげで、ピーターは言っ ジョナサン
public class TaskMBean extends NotificationBroadcasterSupport implements DynamicMBean {
private final TaskStateChangedEventListener taskChangedListener;
public TaskMBean (DriverIf driver) {
taskChangedListener= new TaskStateChangedEventListener (this);
driver.registerMergeTaskStateChangedListener(mergeTaskChangedListener);
}
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
String[] types = new String[] { AttributeChangeNotification.ATTRIBUTE_CHANGE };
String name = AttributeChangeNotification.class.getName();
String description = "An attribute of this MBean has changed";
MBeanNotificationInfo info = new MBeanNotificationInfo(types, name,description);
return new MBeanNotificationInfo[] { info };
}
@Override
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException,
ReflectionException {
// TODO Auto-generated method stub
return null;
}
@Override
public void setAttribute(Attribute attribute) throws AttributeNotFoundException,
InvalidAttributeValueException, MBeanException, ReflectionException {
// TODO Auto-generated method stub
}
@Override
public AttributeList getAttributes(String[] attributes) {
// TODO Auto-generated method stub
return null;
}
@Override
public AttributeList setAttributes(AttributeList attributes) {
// TODO Auto-generated method stub
return null;
}
@Override
public Object invoke(String actionName, Object[] params, String[] signature)
throws MBeanException, ReflectionException {
// TODO Auto-generated method stub
return null;
}
@Override
public MBeanInfo getMBeanInfo() {
MBeanNotificationInfo haltInfo =
new MBeanNotificationInfo(
new String[] { "NOTIFICATION_TYPE_MERGE_STATE_CHANGE" },
Notification.class.getName(), "server halt on fatal error");
MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[] { haltInfo };
return new OpenMBeanInfoSupport(XhiveMergeMBean.class.getName(), "", null, null, null,
notifications);
}
}
public class TaskStateChangedEventListener implements Serializable {
static final String NOTIFICATION_TYPE_MERGE_STATE_CHANGE = "com.xhive.lucene.merge";
private final NotificationBroadcasterSupport broadcaster;
private int notificationSequence = 1;
public TaskStateChangedEventListener (NotificationBroadcasterSupport broadcaster) {
this.broadcaster = broadcaster;
}
@Override
public void notify(Object source) {
Notification n =
new AttributeChangeNotification(this, notificationSequence++, System.currentTimeMillis(), "", "", "int", 1, 2);
broadcaster.sendNotification(n);
}
}
'TaskMergeMBean'は' Serializable'を実装していますか? –