-
1. Re: XMBean persistence problem
dimitris Jan 27, 2005 9:30 AM (in response to rkisilenko2)Hi,
have you seen this:
http://www.jboss.org/wiki/Wiki.jsp?page=XMBeanAttributePersistenceService
This is an extension to the XMBean persistence mechanism, with a default implementation that can write to XML files.
With this persistence manager you can avoid specifying the exact id (that maps to a filename), in which case the ObjectName will be used, so I assume you'll be able to do what you want.
We probably need to update the xmbean persistence examples in the user guide... -
2. Re: XMBean persistence problem
dimitris Jan 27, 2005 9:33 AM (in response to rkisilenko2)BTW, it seems like a good idea to have one -xmbean.xml for each class of mbeans. So far, I've only seen people using a separate -xmbean.xml with each instance...
-
3. Re: XMBean persistence problem
rkisilenko2 Jan 28, 2005 6:19 AM (in response to rkisilenko2)Dimitris, thank you for reply. XMBeanAttributePersistenceService is exactly what I need. I should be more attentive when searchnig for docs. And of course it is possible to distinguish between different MBean instances in PersistanceManager using ObjectName that is stored in ModelMBeanInfo.
But there is also a problem with XMBeanAttributePersistenceService. When XMBean is to be written in file, exception occurs:java.io.FileNotFoundException: file:\N:\jboss-4.0.1\server\default\data\xmbean-attrs\chap2.xmbean@3Aservice@3DJNDIMap.xml (?????? ???????????? ????)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
at org.apache.xalan.transformer.TransformerIdentityImpl.createResultContentHandler(TransformerIdentityImpl.java:235)
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:278)
at org.jboss.system.pm.XMLAttributePersistenceManager.outputXmlFile(XMLAttributePersistenceManager.java:758)
at org.jboss.system.pm.XMLAttributePersistenceManager.store(XMLAttributePersistenceManager.java:332)
at org.jboss.mx.persistence.DelegatingPersistenceManager.store(DelegatingPersistenceManager.java:187)
at org.jboss.mx.modelmbean.ModelMBeanInvoker.store(ModelMBeanInvoker.java:400)
at org.jboss.mx.interceptor.PersistenceInterceptor.invoke(PersistenceInterceptor.java:76)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.server.AbstractMBeanInvoker.setAttribute(AbstractMBeanInvoker.java:446)
at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerImpl.java:591)
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.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:257)
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:144)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:164)
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:144)
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:249)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
I use JBoss 4.0.1 under Windows 2000.
I have also tried running JBoss under Unix. There is no such problem under Unix.
It looks like a bug in DOM impl that is used by JBoss.
I have changed XMBeanAttributePersistenceService.outputXmlFile method to use StreamResult(java.io.OutputStream) constructor instead of StreamResult(java.io.File). Such workaround works ok. Whether should I report a bug? -
4. Re: XMBean persistence problem
dimitris Jan 28, 2005 6:41 AM (in response to rkisilenko2)If I remembed I've put the ObjectName in there, for exactly this reason... :)
I just tried deploying the example from docs/examples/jmx/persistence-service.sar and that works.
Could you please try the same, to see if there is any issue with your setup?
Open an issue in JIRA and send your patch, that'd be great! -
5. Re: XMBean persistence problem
rkisilenko2 Jan 28, 2005 8:49 AM (in response to rkisilenko2)I just tried deploying the example from docs/examples/jmx/persistence-service.sar and that works.
Could you please try the same, to see if there is any issue with your setup?
I have just tried the same. I have made a clean install, deployed example from docs/examples/jmx/persistence-service.sar and changed attribute value of example MBean throught web console.
Again, it does not work under Win2000.
Again, it works under unix. -
6. Re: XMBean persistence problem
dimitris Jan 28, 2005 9:09 AM (in response to rkisilenko2)It works for me on WinXP!? If it works better with your patch on win2k, just submit a bug report&your patch to JIRA, JBoss AS project, JMX component.
Thanks Roman!