Jaxb unmarshal não funciona

Estou usando o jaxb para gerar a nota fiscal eletronica, até agora tudo certo, gerei as classes através dos xsd e wsld, gerei o xml, enviei para a receita, recebi o xml de resposta, mas quando vou fazer o unmarshal, o jaxb so faz do no raiz, os elementos vem todos nulos.

XML de Retorno:

String s = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
		"<retConsStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"1.07\">\n" +
		"<tpAmb>2</tpAmb>\n" +
		"<verAplic>1</verAplic>\n" +
		"<cStat>107</cStat>\n" +
		"<xMotivo>Serviço em operação</xMotivo>\n" +
		"<cUF>52</cUF> \n" +
		"<dhRecbto>2009-09-29T10:39:21</dhRecbto>\n" +
		"<tMed>1</tMed>\n" +
		"</retConsStatServ>";

Classe bean:

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2009.08.31 at 04:04:08 PM BRT 
//


package br.com.jnfe.pl005d;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.datatype.XMLGregorianCalendar;


/**
 * Tipo Resultado da Consulta do Status do Serviço
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TRetConsStatServ", propOrder = {
    "tpAmb",
    "verAplic",
    "cStat",
    "xMotivo",
    "cuf",
    "dhRecbto",
    "tMed",
    "dhRetorno",
    "xObs"
})
@XmlRootElement(name = "retConsStatServ", namespace = "http://www.portalfiscal.inf.br/nfe")
public class TRetConsStatServ {

    @XmlElement(required = true)
    protected String tpAmb;
    @XmlElement(required = true)
    protected String verAplic;
    @XmlElement(required = true)
    protected String cStat;
    @XmlElement(required = true)
    protected String xMotivo;
    @XmlElement(name = "cUF", required = true)
    protected String cuf;
    @XmlElement(required = true)
    protected XMLGregorianCalendar dhRecbto;
    protected String tMed;
    protected XMLGregorianCalendar dhRetorno;
    protected String xObs;
    @XmlAttribute(required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    protected String versao;

    /**
     * Gets the value of the tpAmb property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getTpAmb() {
        return tpAmb;
    }
    public void setTpAmb(String value) {
        this.tpAmb = value;
    }

    /**
     * Gets the value of the verAplic property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getVerAplic() {
        return verAplic;
    }
    public void setVerAplic(String value) {
        this.verAplic = value;
    }

    /**
     * Gets the value of the cStat property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getCStat() {
        return cStat;
    }
    public void setCStat(String value) {
        this.cStat = value;
    }

    /**
     * Gets the value of the xMotivo property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getXMotivo() {
        return xMotivo;
    }
    public void setXMotivo(String value) {
        this.xMotivo = value;
    }

    /**
     * Gets the value of the cuf property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getCUF() {
        return cuf;
    }
    public void setCUF(String value) {
        this.cuf = value;
    }

    /**
     * Gets the value of the dhRecbto property.
     * 
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public XMLGregorianCalendar getDhRecbto() {
        return dhRecbto;
    }
    public void setDhRecbto(XMLGregorianCalendar value) {
        this.dhRecbto = value;
    }

    /**
     * Gets the value of the tMed property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getTMed() {
        return tMed;
    }
    public void setTMed(String value) {
        this.tMed = value;
    }

    /**
     * Gets the value of the dhRetorno property.
     * 
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public XMLGregorianCalendar getDhRetorno() {
        return dhRetorno;
    }
    public void setDhRetorno(XMLGregorianCalendar value) {
        this.dhRetorno = value;
    }

    /**
     * Gets the value of the xObs property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getXObs() {
        return xObs;
    }
    public void setXObs(String value) {
        this.xObs = value;
    }

    /**
     * Gets the value of the versao property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getVersao() {
        return versao;
    }
    public void setVersao(String value) {
        this.versao = value;
    }

}

unmarshal:

DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
			domFactory.setNamespaceAware(true);
			DocumentBuilder builder = domFactory.newDocumentBuilder();
            Document docs = builder.parse(new InputSource(new StringReader(toUnmarshal)));
            
			return getUnmarshaller(contextClazz).unmarshal(docs, contextClazz);

Alguem tem alguma idéia do q acontece?

Tente definir os atributos “name” dos XmlElements, talvez funcione.

@XmlElement(required = true, name = “tpAmb”)
protected String tpAmb;

Já tinha tentado esta alternativa, mas não funcionou.

Já tentou definir o namespace também ?

Definindo o namespace nos elementos, passa a funcionar.

Vc tem ideia do motivo, eu usei o xcj para gerar os beans.

Para quem interessar resolvi assim

JAXBContext jc = JAXBContext.newInstance(contextClazz);
            Unmarshaller u = jc.createUnmarshaller();
            SAXParserFactory parserFactory;
            parserFactory = SAXParserFactory.newInstance();
            parserFactory.setNamespaceAware(false);
            XMLReader reader = parserFactory.newSAXParser().getXMLReader();
            Source er = new SAXSource(reader, new InputSource(new StringReader(toUnmarshal)));
            return getUnmarshaller(contextClazz).unmarshal(er, contextClazz);

Também usei o xjc e tive o mesmo problema.

Isso acontece porque o elemento vem com o namespace definido e o JAXB não o encontra se o namespace não estiver declarado no XmlElement.

Resolvi colocando o namespace na annotation, e depois consigo realizar o unmarshall com 2 linhas:

unmarshaller = context.createUnmarshaller();
unmarshaller.unmarshal( response );