Re: [RomaFramework-dev] Exception while starting blog
Brought to you by:
lvca
|
From: Luca G. <l.g...@pr...> - 2006-05-16 16:58:31
|
Hi Massimiliano, it's better to use MonitoringFeatures.ENABLED constant instead of "enabled" directly. Please replace it in all sources. For the problem you've signaled...I resolved on the fly (revision 200)...it was a bug. Now should works ;-) However...Good work Massimiliano! I hope to include the Monitoring Aspect in the next DEMO and, surely, in a next TUTORIAL ;-) Mhmhm... Rather...Do you want to write it yourself? :-D bye, Luca Garulli Blogging on: http://zion-city.blogspot.com http://www.RomaFramework.org - The new way to build Java applications http://www.Pro-Netics.com (member of Orixo.com - The XML business allianc= e) http://www.OrienTechnologies.com - Light ODBMS, All in one JDO solution On Tue, May 16, 2006 18:12, Massimiliano Loconte said: > Ok..It's done, now it completely avoids to monitorn unwanted fields > (and their accessors methods) or methods. Last question is: do I have > to read the annotation: > > @MonitoringClass(enabled=3DAnnotationConstants.TRUE)? > > I tried to read it in the monitorObject method of the > JmxMonitornAspect class in this way: > > public void monitorObject(Object iObj) throws MonitoringException { > > // REGISTER THE OBJECT PASSED AS PARAMETER INTO THE MBEANSERVER > > SchemaClass cls =3D ObjectContext.getInstance().getComponent( > SchemaManager.class).getClassInfo(iObj.getClass().getSimpl= eName()); > > boolean enabled (Boolean)cls.getFeature(MonitoringAspect.ASPECT_NAME, > "enabled"); > > if(enabled){ > agent.registerMBeans(iObj); > } > } > > but i get an exception when i click on the create button: > > 18:07:04,170 INFO [Controller] [Controller.executeAction] Executing > action: create (action:public void > org.romaframework.module.crud.CRUDMain.create() throws > java.lang.SecurityException,java.lang.NoSuchMethodException,java.lang.I= llegalArgumentException,java.lang.InstantiationException,java.lang.Illega= lAccessException,java.lang.reflect.InvocationTargetException) > on object it.blog2.view.domain.blog.BlogMain@153113d... > 18:07:04,170 WARN [Controller] [Controller.executeAction] error on > execution of method: create > java.lang.ClassCastException: java.lang.Byte > at > org.romaframework.aspect.monitoring.jmx.JmxMonitoringAspect.monitorObje= ct(JmxMonitoringAspect.java:47) > at it.blog2.view.domain.blog.BlogCreate.<init>(BlogCreate.java:20) > at it.blog2.view.domain.blog.BlogCreate.<init>(BlogCreate.java:24) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Metho= d) > at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Sourc= e) > at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown > Source) > ........ > ........ > > do I have to read it? I think it should have a sense but I wonder why > that class cast exception... > > > On 5/16/06, Luca Garulli <l.g...@pr...> wrote: >> Yes, >> @MinitoringField annotation applies to field and getters. >> @MonitoringAction, instead, is for methods. >> >> So you should disable field/getter/setter for >> MinitoringField.enabled=3D=3Dfalse and all methods for >> MinitoringAction.enabled=3D=3Dfalse. >> >> bye, >> Luca Garulli >> Blogging on: http://zion-city.blogspot.com >> http://www.RomaFramework.org - The new way to build Java applications >> http://www.Pro-Netics.com (member of Orixo.com - The XML business >> alliance) >> http://www.OrienTechnologies.com - Light ODBMS, All in one JDO solutio= n >> >> On Tue, May 16, 2006 17:36, Massimiliano Loconte said: >> > Ok..i tested the monitoring setting one field with the annotation: >> > @MonitoringField(enabled=3DAnnotationConstants.FALSE) >> > and works...that attribute is ignored as espected. >> > >> > I have a question, do you think i can generalize saying that once I >> > don't want an attribute to be monitorable i don't want to monitor hi= s >> > getter and setter methods as well(whether it has any)? >> > >> > On 5/16/06, Luca Garulli <l.g...@pr...> wrote: >> >> Yes, >> >> the version of "blog2" project you have doesn't declare the >> >> ComponentFactory. >> >> >> >> Add these lines in applicationContext.xml >> >> >> >> <bean abstract=3D"false" autowire=3D"default" >> >> class=3D"org.romaframework.aspect.view.echo2.component.DefaultCompo= nentFactory" >> >> dependency-check=3D"default" id=3D"ComponentFactory" >> lazy-init=3D"default" >> >> singleton=3D"true"> >> >> </bean> >> >> >> >> bye, >> >> Luca Garulli >> >> Blogging on: http://zion-city.blogspot.com >> >> http://www.RomaFramework.org - The new way to build Java applicatio= ns >> >> http://www.Pro-Netics.com (member of Orixo.com - The XML business >> >> alliance) >> >> http://www.OrienTechnologies.com - Light ODBMS, All in one JDO >> solution >> >> >> >> On Tue, May 16, 2006 16:27, Massimiliano Loconte said: >> >> > Hi, Luca i've just updated svn an recompiled with ant install, >> after >> >> > refreshing in eclipse and starting the blog2 test application i g= et >> >> > the following exception: >> >> > >> >> > 16:23:30,485 INFO [SocketListener] Started SocketListener on >> >> 0.0.0.0:8080 >> >> > 16:23:30,485 WARN [Server] EXCEPTION >> >> > org.mortbay.util.MultiException[org.springframework.beans.factory= .BeanDefinitionStoreException: >> >> > Line 134 in XML document from ServletContext resource >> >> > [/WEB-INF/applicationContext.xml] is invalid; nested exception is >> >> > org.xml.sax.SAXParseException: Attribute value "ComponentFactory" >> of >> >> > type ID must be unique within the document.] >> >> > at org.mortbay.http.HttpServer.doStart(HttpServer.java:686) >> >> > at org.mortbay.util.Container.start(Container.java:72) >> >> > at org.mortbay.jetty.Server.main(Server.java:460) >> >> > org.springframework.beans.factory.BeanDefinitionStoreException: >> Line >> >> > 134 in XML document from ServletContext resource >> >> > [/WEB-INF/applicationContext.xml] is invalid; nested exception is >> >> > org.xml.sax.SAXParseException: Attribute value "ComponentFactory" >> of >> >> > type ID must be unique within the document. >> >> > org.xml.sax.SAXParseException: Attribute value "ComponentFactory" >> of >> >> > type ID must be unique within the document. >> >> > at >> >> > org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseExceptio= n(Unknown >> >> > Source) >> >> > at org.apache.xerces.util.ErrorHandlerWrapper.error(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.dtd.XMLDTDValidator.validateDTDattribute(U= nknown >> >> > Source) >> >> > at >> >> > org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndV= alidate(Unknown >> >> > Source) >> >> > at >> >> org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unkno= wn >> >> > Source) >> >> > at >> >> org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown >> >> > Source) >> >> > at >> >> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartEl= ement(Unknown >> >> > Source) >> >> > at >> >> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentCon= tentDispatcher.dispatch(Unknown >> >> > Source) >> >> > at >> >> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocumen= t(Unknown >> >> > Source) >> >> > at org.apache.xerces.parsers.XML11Configuration.parse(Unkno= wn >> >> Source) >> >> > at org.apache.xerces.parsers.XML11Configuration.parse(Unkno= wn >> >> Source) >> >> > at org.apache.xerces.parsers.XMLParser.parse(Unknown Source= ) >> >> > at org.apache.xerces.parsers.DOMParser.parse(Unknown Source= ) >> >> > at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown >> >> Source) >> >> > at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) >> >> > at >> >> > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loa= dBeanDefinitions(XmlBeanDefinitionReader.java:161) >> >> > at >> >> > org.springframework.beans.factory.support.AbstractBeanDefinitionR= eader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:125) >> >> > at >> >> > org.springframework.beans.factory.support.AbstractBeanDefinitionR= eader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:141) >> >> > at >> >> > org.springframework.web.context.support.XmlWebApplicationContext.= loadBeanDefinitions(XmlWebApplicationContext.java:126) >> >> > at >> >> > org.springframework.web.context.support.XmlWebApplicationContext.= loadBeanDefinitions(XmlWebApplicationContext.java:94) >> >> > at >> >> > org.springframework.context.support.AbstractRefreshableApplicatio= nContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89= ) >> >> > at >> >> > org.springframework.context.support.AbstractApplicationContext.re= fresh(AbstractApplicationContext.java:268) >> >> > at >> >> > org.springframework.web.context.support.AbstractRefreshableWebApp= licationContext.refresh(AbstractRefreshableWebApplicationContext.java:134= ) >> >> > at >> >> > org.springframework.web.context.ContextLoader.createWebApplicatio= nContext(ContextLoader.java:230) >> >> > at >> >> > org.springframework.web.context.ContextLoader.initWebApplicationC= ontext(ContextLoader.java:156) >> >> > at >> >> > org.springframework.web.context.ContextLoaderListener.contextInit= ialized(ContextLoaderListener.java:48) >> >> > at >> >> > org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplic= ationContext.java:495) >> >> > at org.mortbay.util.Container.start(Container.java:72) >> >> > at org.mortbay.http.HttpServer.doStart(HttpServer.java:708) >> >> > at org.mortbay.util.Container.start(Container.java:72) >> >> > at org.mortbay.jetty.Server.main(Server.java:460) >> >> > >> >> > >> >> > Maybe something wrong in a xml file? >> >> > >> >> > Massimiliano Loconte. >> |