Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Heur

xStream - Problema na leiura de XML

Recommended Posts

Olá pessoal.

 

Eu estou usando xStream para ler um xml e jogar nas minhas classes os dados.

Até aí beleza.

Criei as classes, e tal, e mandei o xstream ler o tal do xml.

Porém ele me retornou um erro enorme, no qual tem umas informações.

vejam:

 

Exception in thread "main" com.thoughtworks.xstream.converters.ConversionException: nome : nome : nome : nome
---- Debugging information ----
message             : nome : nome
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : nome : nome
class               : com.andrey.cab.Case
required-type       : java.util.ArrayList
path                : /case/entradas/entrada/nome
line number         : 62
-------------------------------
       at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:89)
       at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
       at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
       at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:246)
       at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:218)
       at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:162)
       at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
       at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
       at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
       at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:246)
       at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:218)
       at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:162)
       at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
       at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
       at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
       at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:60)
       at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:137)
       at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)
       at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:923)
       at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:909)
       at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
       at com.thoughtworks.xstream.XStream.fromXML(XStream.java:845)
       at com.andrey.main.Main.main(Main.java:59)
Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: nome : nome
       at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:68)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:71)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:86)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:96)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
       at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:52)
       at com.thoughtworks.xstream.core.util.HierarchicalStreams.readClassType(HierarchicalStreams.java:29)
       at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:70)
       at com.thoughtworks.xstream.converters.collections.CollectionConverter.populateCollection(CollectionConverter.java:68)
       at com.thoughtworks.xstream.converters.collections.CollectionConverter.unmarshal(CollectionConverter.java:61)
       at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
       ... 22 more
Java Result: 1

 

Isso acontece quando dou um xstream.fromXML(arquivo);

Pelo que eu notei, parece que em uma das classes, onde eu usei um array para armazenar as classes, ele deu pau :(

 

Se alguém tiver pelo menos uma base do que seria o erro, agradeço.

No resto eu me viro daí.

 

Valeu galera.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Sempre que nao for usar simples JavaBeans, procure criar seus proprios conversores, assim você pode obter maior flexibilidade para importar ou exportar.. dah uma olhada em alguns tutoriais no site oficial http://xstream.codehaus.org/converter-tutorial.html

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.