Commons betwixt 0.8 - reading Map from XML
Hi. I am trying to load a map of String, Object from XML back to java using betwixt - with no success. I've exported a Hashtable of String, Object to XML using Betwixt 0.8. The XML i've got is: ?xml version=1.0 encoding=UTF-8 ? metadata map emptytrue/empty entry keygabbaGabbaHey/key valuemd-id-2/value /entry entry keyEntry1/key value123/value /entry entry keyhalooppoRoste/key value-3.76/value /entry /map /metadata After that, i am trying to load the XML back by the following code: BeanReader beanReader = new BeanReader(); beanReader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(false); beanReader.getBindingConfiguration().setMapIDs(false); try { beanReader.registerBeanClass(map, Hashtable.class); beanReader.registerBeanClass(entry/value, String.class); Object tmp; File srcFile = new File(metadata.xml); tmp = instance.beanReader.parse(srcFile); } catch (Exception ex) { logger.log(Level.SEVERE, Failed to read metadata., ex); return null; } I played with beanReader.registerBeanClass - tried to set metadata/map and metadata/map/entry/value as first parameter, disable registerBeanClass commands, remove metadata tags from XML, but the only results i've got are null in tmp variable, or EmptyStackException Sep 1, 2008 5:39:52 PM org.apache.commons.digester.Digester endElement SEVERE: End event threw exception java.util.EmptyStackException at org.apache.commons.collections.ArrayStack.peek(ArrayStack.java:94) at org.apache.commons.betwixt.io.read.ReadContext.getBean(ReadContext.java:351) at org.apache.commons.betwixt.expression.CollectionUpdater.update(CollectionUpdater.java:47) at org.apache.commons.betwixt.io.read.BeanBindAction.update(BeanBindAction.java:171) at org.apache.commons.betwixt.io.read.BeanBindAction.end(BeanBindAction.java:158) at org.apache.commons.betwixt.io.BeanRuleSet$ActionMappingRule.end(BeanRuleSet.java:316) at org.apache.commons.digester.Digester.endElement(Digester.java:1222) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1728) at com.aleri.lms.ui.beans.XMLMetadataProvider.loadMetadata(XMLMetadataProvider.java:83) at com.aleri.lms.ui.beans.XMLMetadataProvider.main(XMLMetadataProvider.java:74) java.util.EmptyStackException at org.apache.commons.digester.Digester.createSAXException(Digester.java:3181) at org.apache.commons.digester.Digester.createSAXException(Digester.java:3207) at org.apache.commons.digester.Digester.endElement(Digester.java:1225) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1728)
[ANNOUNCEMENT] Commons BeanUtils 1.8.0 Released
The Apache Commons project is pleased to announce the release of Commons BeanUtils 1.8.0. Commons BeanUtils provides easy-to-use wrappers around the Reflection and Introspection APIs provided by the Java language. BeanUtils 1.8.0 is binary compatible with version 1.7.0 and contains a number of bug fixes and enhancements. Full details of changes are available in the Release Notes: http://commons.apache.org/beanutils/v1.8.0/RELEASE-NOTES.txt Commons BeanUtils is available in either binary or source form from the following download page: http://commons.apache.org/beanutils/download_beanutils.cgi For more information on Commons BeanUtils, visit the project home page: http://commons.apache.org/beanutils/ - Niall Pemberton - on behalf of the Apache Commons community - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Commons Configuration] Why this Java code rise a Exception ?
Hello, Why this Java code rise a Exception in thread main java.lang.NoClassDefFoundError ? Thanks, Pierre8r package com.test.configuration; import org.apache.commons.configuration.BaseConfiguration; public class testCommonsConfig001 { public static void main(String[] args) { BaseConfiguration config = new BaseConfiguration(); config.addProperty(intProperty, 22); System.out.println(config.getInt(intProperty)); } } The output console : Exception in thread main java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at com.test.configuration.testCommonsConfig001.main(testCommonsConfig001.java:9) Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 25 more -- View this message in context: http://www.nabble.com/-Commons-Configuration--Why-this-Java-code-rise-a-Exception---tp19260543p19260543.html Sent from the Commons - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [SCXML] Java-scxml interaction
Hello, I need this this info very much:(... I am trying to do something with invoke now. Is it a good way? If yes, can I please have any examples. Anna 2008/8/31 Anna Klisiewicz [EMAIL PROTECTED] Hi I don't know how to make bridging between scxml and java possible. In my program first I run the state machine. In some of the states, I would like to ask user questions (together with the transitions) and come back to the execution of state machine after getting an answer. How to do it? I tried triggering events, but I am not sure if that's the right way. What about listener?.. Thank you, Anna
Re: [SCXML] Java-scxml interaction
Not actual anymore - I think I have done it with invoker. By the way, how to get access to datamodel? So far I was doing it in the same function where I was executing SCXML. now I want use them in conditions in Invoke function. Shall I send them by param or is there more convienient way, like getData() or something Sorry for the spam Anna