Como converter ArrayList <Object> para um XML usando JAXB?
Eu estou tentando converter ArrayList para xml usando JAXB ..
ArrayList<LDAPUser> myList = new ArrayList<LDAPUser>();
myList = retrieveUserAttributes.getUserBasicAttributes(lastName,
retrieveUserAttributes.getLdapContext());
JAXBContext jaxbContext = JAXBContext.newInstance(LDAPUser.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
StringWriter sw = new StringWriter();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbMarshaller.marshal(myList, sw);
System.out.println(sw.toString());
return sw.toString();
... mas não está funcionando, estou recebendo este erro:
27-Aug-2012 10:43:58 org.apache.catalina.core.StandardWrapperValve invoca SEVERE: Servlet.service () para o servlet [spring] no contexto com o caminho [/ Spring3-LDAP-WebService] lançou exceção [Falha no processamento da solicitação ; A exceção aninhada é javax.xml.bind.JAXBException:class java.util.ArrayList nem qualquer de sua superclasse é conhecida neste contexto.] com causa raiz javax.xml.bind.JAXBException: class java.util.ArrayList nem qualquer de sua superclasse é conhecida neste contexto. em com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getBeanInfo (JAXBContextImpl.java:554) em com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot (XMLSerializer.java:470) em com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write (MarshallerImpl.java:314) em com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal (MarshallerImpl.java:243) em javax.xml.bind.helpers.AbstractMarshallerImpl.marshal (AbstractMarshallerImpl.java:96) em ie.revenue.spring.RestController.searchLdapUsersByLastNameTwo (RestController.java:69) em sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) ao sol .reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) ...........
Por favor ajude! Obrigado.