VRaptor + Hibernate + OneToMany

Quando estou trabalhando com um relacionamento OneToMany (no caso uma lista) com Hibernate o tipo na verdade por trás logo após uma consulta é o PersistentBag.
Na hora de transformar o objeto em json ocorre um erro de referencia circular porque o XStream não sabe trabalhar com o PersistentBag…

Para resolver o caso criei uma classe que extends XStreamJSONSerialization e sobrescrevi o método getXStream, dai surge minhas dúvidas:

O método getXStream está deprecated… Existe uma outra maneira de registrar o converter?
Existe uma maneira melhor para resolver tal situação?

tem sim, cria o converter e anota com @Component

não precisa mais sobrescrever o componente do VRaptor…

Lucas, eu implemento o Converter do VRaptor ou do XStream?

No caso de implementar o Converter do VRaptor como faria para enviar o list para o próximo na cadeia que sabe manusear o mesmo?

@Component
public class PersistentBagConverter implements Converter {
	
	@Override
	@SuppressWarnings("rawtypes")
	public boolean canConvert(Class type) {
		return PersistentBag.class == type;
	}

	@Override
	@SuppressWarnings("unchecked")
	public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
        context.convertAnother(new ArrayList<Object>((PersistentBag) source));
	}

	@Override
	public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
		return null;
	}

}

faça que nem nesse post:

http://www.wbotelhos.com.br/2010/08/26/vraptor-3-evitando-circularreferenceexception-do-xstream/

(a parte do collection converter)

só que a idéia é criá-lo como uma classe separada, anotada com @Component. Vc pode fazer assim:

@Component
public class PersistentBagConverter extends CollectionConverter {
            public PersistentBagConverter(XStreamBuilder builder) {
                  super(builder.jsonInstance().getMapper());
            }
            @Override
            @SuppressWarnings("rawtypes")
            public boolean canConvert(Class type) {
                return Collection.class.isAssignableFrom(type);
            }
}

Mas nesse caso como eu registraria o Converter com o XStream? O VRaptor não vez o registro automaticamente só pela a anotação @Component.

vc tá com o VRaptor 3.4.0, certo?

vc usou o @Component do VRaptor?

vc apagou o customJSONSerialization que tinha criado?

package br.com.egm.filter;

import java.util.Collection;

import br.com.caelum.vraptor.ioc.Component;
import br.com.caelum.vraptor.serialization.xstream.XStreamBuilder;

import com.thoughtworks.xstream.converters.collections.CollectionConverter;

@Component
public class PersistentBagConverter extends CollectionConverter {

	public PersistentBagConverter(XStreamBuilder builder) {
		super(builder.jsonInstance().getMapper());		
	}

	@Override
	@SuppressWarnings("rawtypes")
	public boolean canConvert(Class type) {
		return Collection.class.isAssignableFrom(type);
	}
	
}

Estou com o VRaptor 3.4.0.
Eu apaguei o CustomJSONSerialization estou com apenas esse Converter no meu classpath.

bom, se essa classe está junto com as classes da sua aplicação deveria funcionar sim… =(

tenta dar clean no projeto e no servidor, pode ser que as classes antigas ainda estejam no classpath.

Eu já realizei o clean, mas o VRaptor nem cria a instancia da mesma.

Se eu mudar o scope da classe para @ApplicationScoped o VRaptor reclama do construtor…

Os convertes que são registrados automaticamente implementam o Converter do VRaptor e possuem uma anotação em sua classe @Converter.

na última versão ele registra os converters do XStream automaticamente também, ou pelo menos deveria…

qual servidor vc está usando? qual IDE? está iniciando a aplicação pela IDE?

Eclipse Indigo e Tomcat 6.0.23.

tenta imprimir algo tanto no construtor quanto no canConvert da classe…

vc está serializando com result.use(json()).from(objeto).serialize()?

Estou usando ‘result.use(ExtJSJson.class).from(objeto).total(int).serialize();’.

Não imprimi nada… A instancia da classe nem é criada.

ah, então é por isso… tenta com o json()… não lembro se o ExtJSJson está usando a infra nova de geração do json

Lucas lançou a exception quando troquei para o json():

18:51:09,431 DEBUG [DefaultExceptionMapper] find for exception class org.springframework.beans.factory.UnsatisfiedDependencyException
18:51:09,431 DEBUG [DefaultExceptionMapper] find for exception class org.springframework.beans.factory.UnsatisfiedDependencyException
18:51:09,431 DEBUG [DefaultExceptionMapper] find for exception class org.springframework.beans.factory.UnsatisfiedDependencyException
18:51:09,431 DEBUG [DefaultExceptionMapper] find for exception class org.springframework.beans.factory.UnsatisfiedDependencyException
18:51:09,431 DEBUG [DefaultExceptionMapper] find for exception class org.springframework.beans.factory.BeanCurrentlyInCreationException
14/10/2011 18:51:09 org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet default threw exception
br.com.caelum.vraptor.InterceptionException: exception raised, check root cause for details: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamJSONSerialization’: Unsatisfied dependency expressed through constructor argument with index 3 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamConverters]: : Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamBuilderImpl’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamConverters]: : Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?
at br.com.caelum.vraptor.interceptor.ExecuteMethodInterceptor.intercept(ExecuteMethodInterceptor.java:96)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.core.LazyInterceptorHandler.execute(LazyInterceptorHandler.java:61)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.ParametersInstantiatorInterceptor.intercept(ParametersInstantiatorInterceptor.java:87)
at br.com.caelum.vraptor.core.LazyInterceptorHandler.execute(LazyInterceptorHandler.java:59)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.core.LazyInterceptorHandler.execute(LazyInterceptorHandler.java:61)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.util.hibernate.HibernateTransactionInterceptor.intercept(HibernateTransactionInterceptor.java:48)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.InstantiateInterceptor.intercept(InstantiateInterceptor.java:48)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.ExceptionHandlerInterceptor.intercept(ExceptionHandlerInterceptor.java:71)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.FlashInterceptor.intercept(FlashInterceptor.java:83)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.ResourceLookupInterceptor.intercept(ResourceLookupInterceptor.java:69)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.core.EnhancedRequestExecution.execute(EnhancedRequestExecution.java:44)
at br.com.caelum.vraptor.VRaptor$1.insideRequest(VRaptor.java:92)
at br.com.caelum.vraptor.ioc.spring.SpringProvider.provideForRequest(SpringProvider.java:58)
at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamJSONSerialization’: Unsatisfied dependency expressed through constructor argument with index 3 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamConverters]: : Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamBuilderImpl’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamConverters]: : Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:263)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083)
at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.instanceFor(SpringBasedContainer.java:86)
at br.com.caelum.vraptor.core.DefaultResult.use(DefaultResult.java:57)
at br.com.egm.controller.FornecedorController.listar(FornecedorController.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at br.com.caelum.vraptor.interceptor.ExecuteMethodInterceptor.intercept(ExecuteMethodInterceptor.java:61)
… 40 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamBuilderImpl’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamConverters]: : Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 59 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XStreamConverters’: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: : Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 71 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘persistentBagConverter’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.vraptor.serialization.xstream.XStreamBuilder]: : Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:744)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 85 more
Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘XStreamBuilderImpl’: Requested bean is currently in creation: Is there an unresolvable circular reference?
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:252)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 99 more

não pode receber o XStreamBuilder no construtor, sry… usa um new XStream().getMapper() ao invés disso