[Management, JMX/JBoss] - Re: Problem with monitoring and notifications
by fgeymonat
I have experienced the same problem, and i solve it modifying the EmailAlertListener adding the necesary code for manually clear the alerts.
Next i copy the code to you.
/*
| * JBoss, the OpenSource J2EE webOS
| *
| * Distributable under LGPL license.
| * See terms of license at gnu.org.
| */
| package org.jboss.monitor.alerts;
|
| import java.util.HashSet;
| import java.util.Iterator;
| import java.util.Map;
| import java.util.Set;
| import java.util.StringTokenizer;
|
| import javax.mail.Address;
| import javax.mail.Message;
| import javax.mail.Session;
| import javax.mail.Transport;
| import javax.mail.internet.AddressException;
| import javax.mail.internet.InternetAddress;
| import javax.mail.internet.MimeMessage;
| import javax.management.MBeanServer;
| import javax.management.Notification;
| import javax.management.ObjectName;
| import javax.naming.InitialContext;
|
| import org.jboss.monitor.JBossMonitorNotification;
| import org.jboss.monitor.alerts.JBossAlertListener;
| import org.jboss.mx.util.InstanceOfQueryExp;
| import org.jboss.mx.util.MBeanServerLocator;
| import org.jboss.util.Strings;
|
| /**
| * Comment
| *
| * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
| * @version $Revision: 1.3 $
| *
| **/
| public class EmailAlertListener extends JBossAlertListener implements EmailAlertListenerMBean
| {
| protected String messageTemplate;
| protected String subjectTemplate;
| protected String fromString;
| protected Address from;
| protected String replyToString;
| protected Address replyTo;
| protected Address[] to;
| protected HashSet toSet = new HashSet();
|
|
| public void handleNotification(Notification notification,
| Object handback)
| {
| if (!(notification instanceof JBossMonitorNotification)) return;
| JBossMonitorNotification jBossNotification = (JBossMonitorNotification) notification;
| Map substitutions = ((JBossMonitorNotification) notification).substitutionMap();
| String message = Strings.subst(messageTemplate, substitutions, "%(", ")");
| String subject = Strings.subst(subjectTemplate, substitutions, "%(", ")");
| try
| {
| Session session = (Session) new InitialContext().lookup("java:/Mail");
| // create a message
| //
| Address replyToList[] = { replyTo };
| Message newMessage = new MimeMessage(session);
| newMessage.setFrom(from);
| newMessage.setReplyTo(replyToList);
| newMessage.setRecipients(Message.RecipientType.TO, to);
| newMessage.setSubject(subject);
| newMessage.setSentDate(new java.util.Date());
| newMessage.setText(message);
|
| // Send newMessage
| //
| Transport transport = session.getTransport();
| transport.connect();
| transport.sendMessage(newMessage, to);
|
| // Cleans the alert...jejeje...
| //
| MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
| InstanceOfQueryExp queryExp = null;
| queryExp = new InstanceOfQueryExp("org.jboss.monitor.JBossMonitorMBean");
| Set monitors = mbeanServer.queryNames(null, queryExp);
| Iterator mbeans = monitors.iterator();
| while (mbeans.hasNext()) {
| ObjectName monitorObjectName = (ObjectName)mbeans.next();
| String monitorName = (String)mbeanServer.getAttribute(monitorObjectName, "MonitorName");
|
| Object[] nullArgs = {};
| String[] nullSignature = {};
| log.debug("Verifying status for monitor: " + monitorName.toString());
| boolean alerted = ((Boolean)mbeanServer.invoke(monitorObjectName, "alerted", nullArgs, nullSignature)).booleanValue();
| if (monitorName.equals(jBossNotification.getMonitorName()) && alerted) {
| try
| {
| log.debug("Clearing Alert for monitor: " + monitorName.toString());
| mbeanServer.invoke(monitorObjectName, "clearAlert", nullArgs, nullSignature);
| break;
| }
| catch (Exception ex)
| {
| log.debug("Failed to Clear Alert: " + monitorName.toString());
| ex.printStackTrace();
| }
| }
| }
| }
| catch (Exception ex)
| {
| ex.printStackTrace();
| }
|
| }
|
|
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016480#4016480
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016480
19Â years, 2Â months
[JBoss Portal] - How to define portal default page using XML descriptors
by simplex-software
Greetings,
The default page in a portal, the one which displays when launching the portal, is the page named "default". It happens that in the portal I'm working on, there is no such a page, the default one's name being "General". After each deployment I need to go into the admin portal, and to manually modify my portal's default page as being the page named General. This is probably possible also in the portal's XML descriptors but I didn't find anything. So, my question is: how may I modify the portal default's page, exactly as I'm doing using the administration portlet, but in the XML descriptors, such that to avoid doing it manually, after each deployment ?
Many thanks in advance,
Nicolas
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016477#4016477
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016477
19Â years, 2Â months
[JCA/JBoss] - autocommit question
by wang.565
I've created a web application using Sun Creator 2.1 and try to deploy it in JBoss 4.0.4. However, I saw the following exception:
14:33:26,329 ERROR [STDERR] java.sql.SQLException: You cannot commit with autocommit set!
14:33:26,329 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWra pperManagedConnection.java:545)
14:33:26,345 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java :334)
14:33:26,345 ERROR [STDERR] at com.sun.sql.rowset.internal.CachedRowSetXReader.readData(CachedRowSetXReader.ja va:244)
14:33:26,345 ERROR [STDERR] at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:950)
14:33:26,345 ERROR [STDERR] at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:1410)
...
As you can see, I used cachedrowset in my application. my data-source configuration in jboss is something like;
<local-tx-datasource> <connection-url>jdbc:microsoft:sqlserver://myserver:1433;DatabaseName=myt est;SelectMethod=Cursor</connection-url> <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-cla ss>
<connection-property name="auto-commit">false</connection-property>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>5</idle-timeout-minutes>
</local-tx-datasource>
Is there a simple work-around on this problem?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016470#4016470
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016470
19Â years, 2Â months
[JBoss Seam] - problem with 1.1.6GA ? duplicate factory for: actor
by shasho
Hi
When replacing the seam jar files from version 1.1.1GA with the ones of 1.1.6GA I get the following error
| 18:57:26,234 ERROR [[/buysell]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
| java.lang.IllegalStateException: duplicate factory for: actor
| at org.jboss.seam.core.Init.checkDuplicateFactory(Init.java:178)
| at org.jboss.seam.core.Init.addFactoryValueBinding(Init.java:196)
| at org.jboss.seam.init.Initialization.addComponents(Initialization.java:706)
| at org.jboss.seam.init.Initialization.init(Initialization.java:451)
| at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
| at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)
| at org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
| at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
| at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
| at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
| at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
| at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
| at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
| at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
| at org.jboss.web.WebModule.startModule(WebModule.java:83)
| at org.jboss.web.WebModule.startService(WebModule.java:61)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy0.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:417)
| at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy38.start(Unknown Source)
| at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
| at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
| at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
| at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
| at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy39.start(Unknown Source)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy6.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy0.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:417)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy4.start(Unknown Source)
| at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy5.deploy(Unknown Source)
| at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
| at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
| at org.jboss.Main.boot(Main.java:200)
| at org.jboss.Main$1.run(Main.java:490)
| at java.lang.Thread.run(Thread.java:595)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016469#4016469
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016469
19Â years, 2Â months