Leo22
Janeiro 3, 2011, 10:03am
#1
Pessoal,
Estou passando pelo seguinte problema:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
javax.xml.bind.JAXBElement does not have a no-arg default constructor.
this problem is related to the following location:
at javax.xml.bind.JAXBElement
at protected java.util.List xml.TLoteDistDFe103.nsuAndCTeDistOrCancDist
at xml.TLoteDistDFe103
at protected xml.TLoteDistDFe103 xml.TRetDistDFe103.loteDistCTe
at xml.TRetDistDFe103
Configuração: Glassfish V3 + EJB 3.1
Obrigado
Qual a classe JavaBean que você está tentando recuperar? Ou em outras palavras: o XML representa qual classe Java?
Leo22
Janeiro 3, 2011, 11:02am
#3
Estou trabalhando direto com os objetos gerados pelo jaxb.
tenho algumas classes assim:
Tenho o seguinte:
@XmlElements({
@XmlElement(name = "Canc_Dist",type = JAXBElement.class),
@XmlElement(name = "NSU", namespace="namespace", type = JAXBElement.class),
@XmlElement(name = "Inut_Dist", namespace="namespace", type = JAXBElement.class),
@XmlElement(name = "CTe_Dist", namespace="namespace", type = JAXBElement.class)
})
protected List<JAXBElement<?>> nsuAndCTeDistOrCancDist;
Na minha ObjectFacory.java tenho:
private final static QName _DistCTe_QNAME = new QName("namespace", "distCTe");
@XmlElementDecl(name = "distCTe")
public JAXBElement<TDistDFe103> createDistCTe(TDistDFe103 value) {
return new JAXBElement<TDistDFe103>(_DistCTe_QNAME, TDistDFe103 .class, null, value);
}
um metodo desse pra cada @XmlElement
estou trabalhando diretamente comos objetos gerados, fazendo testes iniciais para ver se esta tudo funcionado corretamente.
alguma luz?
Obrigado!
Talvez isso ajude: http://blog.caelum.com.br/jaxb-xml-e-java-de-maos-dadas/
Você vai usar XML para trabalhar com NFe?
Leo22
Janeiro 3, 2011, 11:28am
#5
vou dar uma olhada…
sim é pra trabalhar com NFe
Obrigado!