From: DJ G. <dj...@op...> - 2006-04-15 07:36:09
|
Hey all, I just finished committing the last chunk some major work in the Manager (src/services/org/opennms/netmgt/vmmgr/Manager.java) and related code. This involves three big things: 1) Refactor of the code to remove duplication and make methods shorter. 2) Cleanup of the service-configuration.xml file so that all invoke tags now require an "at" tag ("start" is no longer assumed). Also changed the name of the Manager app to Manager instead of FastExit (I assume that this was very legacy, and it was indeed very confusing). Note that this means that you have to copy over a new service- configuration.xml file when you update to a current version of HEAD. 3) Changed the start(MBeanServer) method in the Manager so that it will fail quickly in event of an error, and proceed to shutdown anything that was running and terminate the JVM. Descriptive messages are logged to the manager log file and to stderr (which ends up in output.log). The last one is the big one. As long as major problems are caught in the init() or start() methods of the various daemons, OpenNMS should no longer run if something big is broken. I think this should help out the end user impression of OpenNMS' reliability because errors should be able to be caught more quickly and we won't have OpenNMSM partially running. For example, here is what happened with the current code when I broke eventconf.xml: knitcluster44:~/opennms/HEAD/opennms dgregor$ sudo dist/bin/opennms start Starting OpenNMS: Started OpenNMS, but it stopped running: check output.log failed knitcluster44:~/opennms/HEAD/opennms dgregor$ And here's what's in output.log: Caused by: An error occurred while attempting to start the "OpenNMS:Name=Eventd" service (class org.opennms.netmgt.eventd.jmx.Eventd). Shutting down and exiting javax.management.RuntimeMBeanException: null nested runtime exception is java.lang.reflect.UndeclaredThrowableException java.lang.reflect.UndeclaredThrowableException at org.opennms.netmgt.eventd.jmx.Eventd.init(Eventd.java:103) 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:324) at mx4j.server.ReflectionMBeanInvoker.invokeImpl (ReflectionMBeanInvoker.java:156) at mx4j.server.ReflectionMBeanInvoker.doInvoke (ReflectionMBeanInvoker.java:117) at mx4j.server.ReflectionMBeanInvoker.invoke (ReflectionMBeanInvoker.java:52) at mx4j.server.interceptor.InvokerMBeanServerInterceptor.invoke (InvokerMBeanServerInterceptor.java:238) at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke (DefaultMBeanServerInterceptor.java:120) at mx4j.server.interceptor.SecurityMBeanServerInterceptor.invoke (SecurityMBeanServerInterceptor.java:84) at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke (DefaultMBeanServerInterceptor.java:120) at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke (DefaultMBeanServerInterceptor.java:120) at mx4j.server.interceptor.ContextClassLoaderMBeanServerInterceptor.invoke( ContextClassLoaderMBeanServerInterceptor.java:203) at mx4j.server.MX4JMBeanServer.invoke(MX4JMBeanServer.java: 1043) at org.opennms.netmgt.vmmgr.Manager.invoke(Manager.java:514) at org.opennms.netmgt.vmmgr.Manager.invokeMethods (Manager.java:455) at org.opennms.netmgt.vmmgr.Manager.getInstancesAndInvoke (Manager.java:322) at org.opennms.netmgt.vmmgr.Manager.start(Manager.java:222) at org.opennms.netmgt.vmmgr.Manager.doStartCommand (Manager.java:608) at org.opennms.netmgt.vmmgr.Manager.main(Manager.java:590) 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:324) at org.opennms.bootstrap.Bootstrap$3.run(Bootstrap.java:325) at java.lang.Thread.run(Thread.java:552) Caused by: Parsing Error : The end-tag for element type "event" must end with a '>' delimiter. Line : 1211 Column : 9 {file: [not available]; line: 1211; column: 9} at org.exolab.castor.xml.Unmarshaller.unmarshal (Unmarshaller.java:671) at org.exolab.castor.xml.Unmarshaller.unmarshal (Unmarshaller.java:565) at org.exolab.castor.xml.Unmarshaller.unmarshal (Unmarshaller.java:748) at org.opennms.netmgt.eventd.EventConfigurationManager.loadConfiguration (EventConfigurationManager.java:154) at org.opennms.netmgt.eventd.EventConfigurationManager.loadConfiguration (EventConfigurationManager.java:133) at org.opennms.netmgt.eventd.jmx.Eventd.init(Eventd.java:100) ... 26 more Caused by: org.xml.sax.SAXException: Parsing Error : The end-tag for element type "event" must end with a '>' delimiter. Line : 1211 Column : 9 at org.exolab.castor.xml.UnmarshalHandler.fatalError (UnmarshalHandler.java:2338) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError (Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError (Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError (Unknown Source) at org.apache.xerces.impl.XMLScanner.reportFatalError (Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement (Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl $FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument (Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.exolab.castor.xml.Unmarshaller.unmarshal (Unmarshaller.java:657) ... 31 more Bleh... horribly long in this case, but the cause of the error is in there, and as long as the daemons throw exceptions with some kind of useful information, it should help track things down, especially with knowing what part of OpenNMS broke. This is a somewhat major change of the functionality of the Manager, and I know that I did it without asking, but I figured that it's useful enough that it should be added. ;-) Worst case, I ask for your forgiveness. :-) Please let me know what you think, especially complaints, - djg |