6 Replies Latest reply on Jul 25, 2006 12:53 PM by Andrew Oliver

    Agregar un MAilListener

    Nicolas Escribal Newbie

      Cómo hago para hacer un listener de mails en JBOSS de manera que cuando reciba un mail una determinada dirección el servidor de mail ejecute un método.
      Probé con addMailListener al objeto session pero no hace nada y probé con los listeners de las folders pero tampoco.
      MUchas gracias.

        • 1. Re: Agregar un MAilListener
          Andrew Oliver Master

          edit $JBMS_HOME/server/default/deploy/mail.ear/mail.sar/META-INF/jboss-service.xml

          Use an existing listener as a template. Give it a service definition and add it to the MailListenerChain where you want it called (order matters).

           <mbean code="org.jboss.mail.MailListenerChainService"
           name="jboss.mail:type=MailServices,name=MailListenerChain" xmbean-dd="META-INF/chain-xmbean.xml">
           <depends>jboss.mail:type=MailServices,name=MailListener</depends>
           <attribute name="Listeners">
           <listeners>
           <!-- Uncomment to allow replies to go to Nukes
           <value>jboss.mail:type=MailServices,name=NukesPosterJMSListener</value>
           -->
           <listener>jboss.mail:type=MailServices,name=MailListener</listener>
           </listeners>
           </attribute>
           </mbean>
          
          ...
          
           <mbean code="org.jboss.mail.maillistener.JMSMailListener"
           name="jboss.mail:type=MailServices,name=MailListener">
          ...
           </mbean>
          


          Does that make sense?

          -andy

          • 2. Re: Agregar un MAilListener
            Nicolas Escribal Newbie

            Hola.
            Seguí los pasos que me dijiste, es decir copié la clase JMSMailListener, le cambié el nombre, la compilé y edité el archivo jboss-service.xml.
            Al levantar el JBOSS arrojó las siguientes excepciones:

            13:23:10,234 ERROR [MainDeployer] Could not create deployment: file:/C:/DESARROLLO/JBossMailServer/server/default/deploy/mail.ear/mail.sar/
            org.jboss.deployment.DeploymentException: Class does not expose a management interface: java.lang.Object; - nested throwable: (javax.management.NotCompliantMBeanException: Class does not expose a management interface: java.lang.Object)
            at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:178)
            at org.jboss.system.ServiceController.install(ServiceController.java:215)
            at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
            at $Proxy4.install(Unknown Source)
            at org.jboss.deployment.SARDeployer.create(SARDeployer.java:232)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:935)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:925)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:789)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
            at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
            at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
            at $Proxy9.deploy(Unknown Source)
            at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:265)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
            at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
            at $Proxy0.start(Unknown Source)
            at org.jboss.system.ServiceController.start(ServiceController.java:428)
            at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
            at $Proxy4.start(Unknown Source)
            at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
            at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
            at $Proxy5.deploy(Unknown Source)
            at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:453)
            at org.jboss.system.server.ServerImpl.start(ServerImpl.java:330)
            at org.jboss.Main.boot(Main.java:187)
            at org.jboss.Main$1.run(Main.java:438)
            at java.lang.Thread.run(Unknown Source)
            Caused by: javax.management.NotCompliantMBeanException: Class does not expose a management interface: java.lang.Object
            at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:88)
            at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:86)
            at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:86)
            at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:86)
            at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:167)
            at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
            at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
            at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1407)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1402)
            at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1335)
            at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:330)
            at org.jboss.system.ServiceCreator.install(ServiceCreator.java:124)
            at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:431)
            at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:153)
            ... 80 more
            13:23:10,265 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

            • 3. Re: Agregar un MAilListener
              Nicolas Escribal Newbie

              Gracias por todo.

              • 4. Re: Agregar un MAilListener
                Andrew Oliver Master

                You must either add some management interface:

                MyClass implements MyClassMBean

                OR

                create an xmbean descriptor. (Look at one of the mbeans with xmbean-dd= in the jboss-service.xml and look at the mentioned file)

                The error means that you have neither.

                • 5. Re: Agregar un MAilListener
                  Nicolas Escribal Newbie

                  Ok. Gracias, ya lo pude resolver. Disculpa las molestias.

                  • 6. Re: Agregar un MAilListener
                    Andrew Oliver Master

                    no problem.