Hello again,

 

I’m getting the error listed below when trying to start up OpenNMS using my own 
event listener.  It gets reported many times.  Do I need to set up the 
eventSubscriptionService as well?  If so, I’m not sure what I need to do.  I’m 
using xml you listed below, but I’m substituting my class in place  of 
MyEventListener.

 

Any ideas what I’m doing wrong?

 

Thanks for the help,

DJ Spiess

 

Cannot resolve reference to bean 'eventSubscriptionService' while setting bean 
property 'eventSubscriptionService'; nested exception is 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 
'eventSubscriptionService' is defined

        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrow(DefaultMBeanServerInterceptor.java:856)

        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrowMaybeMBeanException(DefaultMBeanServerInterceptor.java:869)

        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:838)

        at 
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)

        at org.opennms.netmgt.vmmgr.Invoker.invoke(Invoker.java:338)

        at org.opennms.netmgt.vmmgr.Invoker.invokeMethods(Invoker.java:261)

        at org.opennms.netmgt.vmmgr.Starter.start(Starter.java:268)

        at org.opennms.netmgt.vmmgr.Starter.startDaemon(Starter.java:136)

        at org.opennms.netmgt.vmmgr.Controller.start(Controller.java:211)

        at org.opennms.netmgt.vmmgr.Controller.main(Controller.java:183)

        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:597)

        at org.opennms.bootstrap.Bootstrap$3.run(Bootstrap.java:353)

        at java.lang.Thread.run(Thread.java:662)

 

From: Benjamin Reed [mailto:ran...@opennms.org] 
Sent: Monday, February 07, 2011 4:21 PM
To: dspi...@neoninc.org
Cc: OpenNMS Code Development and Bugs
Subject: Re: [opennms-discuss] Trying to create my own NotificationStrategy

 


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/7/11 6:06 PM, DJ Spiess wrote:
>



      > So would I just implement

      org.opennms.netmgt.eventd.Eventhandler and



      > handle putting the event on the queue? 



      >

Yeah, you annotate the class with @EventListener and give it a unique
name, and then add an @EventHandler annotation to your method for
handling the incoming events.

> How do I register this event

      handler with OpenNMS? Is that handled



      > by the attribute (@EventListener) at the beginning of the

      class? 



      >

To register it, you'll need to make a file in your jar that tells
spring how to load it up.  We probably should make an example project
for this.  =)

You'll want to make your own little project.  If you do it in maven,
then you'd do:

src/main/java/foo/MyEventListener.java
src/main/resources/META-INF/opennms/component-dao.xml

The component-dao.xml would look like this:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns= <http://www.springframework.org/schema/beans> 
"http://www.springframework.org/schema/beans";
       xmlns:xsi= <http://www.w3.org/2001/XMLSchema-instance> 
"http://www.w3.org/2001/XMLSchema-instance";
       xmlns:tx= <http://www.springframework.org/schema/tx> 
"http://www.springframework.org/schema/tx";
       xmlns:context= <http://www.springframework.org/schema/context> 
"http://www.springframework.org/schema/context";
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
       http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd";
       >

  <context:annotation-config/>
 
  <bean name="myEventListener" class="foo.MyEventListener" />

  <bean id="myEventListenerAdapter"
class="org.opennms.netmgt.model.events.AnnotationBasedEventListenerAdapter">
    <property name="annotatedListener" ref="myEventListener" />
    <property name="eventSubscriptionService"
ref="eventSubscriptionService" />
  </bean>

</beans>


> Sorry for the noob questions,

      but I’m very new to OpenNMS.



      >

It's OK, it's magic, but rather complex.  =)

Also, I've gone ahead and moved this to the opennms-devel list,
instead of opennms-discuss, which is more for configuration and such.

- -- 
Benjamin Reed
The OpenNMS Group
http://www.opennms.org/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFNUH5zUu+jZtP2Zf4RAkkYAKCO4gyah/SQKG9mzdtmMuxL7mmc2wCfYWt/
GX0v3GF0pdgOXeHqgnWy77c=
=ryFL
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this 
page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

Reply via email to