Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within EJB and other Jakarta /Java EE Technologies
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
EJB and other Jakarta /Java EE Technologies
javax.xml.bind.JAXBContext.newInstance error
Fernando Sanchez
Ranch Hand
Posts: 43
posted 1 year ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi, I'm absolute beginner at JAXB.
I'm trying with Eclipse some code from a textbook but I get this error when trying it:
This is the class with the main method:
package clasesjaxb; import java.util.ArrayList; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement() public class Libreria { private ArrayList<Libro> listaLibro; private String nombre; private String lugar; public Libreria(ArrayList<Libro> listaLibro, String nombre, String lugar) { super(); this.listaLibro = listaLibro; this.nombre = nombre; this.lugar = lugar; } public Libreria() {} public void setNombre(String nombre) { this.nombre = nombre; } public void setLugar(String lugar) { this.lugar = lugar; } public String getNombre() { return nombre; } public String getLugar() { return lugar; } //Wrapper, envoltura alrededor de la representación XML @XmlElementWrapper(name = "ListaLibro") @XmlElement(name = "Libro") public ArrayList<Libro> getListaLibro() { return listaLibro; } public void setListaLibro(ArrayList<Libro> listaLibro) { this.listaLibro = listaLibro; } }
included in a packages with two other classes:
package clasesjaxb; import java.util.ArrayList; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement() public class Libreria { private ArrayList<Libro> listaLibro; private String nombre; private String lugar; public Libreria(ArrayList<Libro> listaLibro, String nombre, String lugar) { super(); this.listaLibro = listaLibro; this.nombre = nombre; this.lugar = lugar; } public Libreria() {} public void setNombre(String nombre) { this.nombre = nombre; } public void setLugar(String lugar) { this.lugar = lugar; } public String getNombre() { return nombre; } public String getLugar() { return lugar; } //Wrapper, envoltura alrededor de la representación XML @XmlElementWrapper(name = "ListaLibro") @XmlElement(name = "Libro") public ArrayList<Libro> getListaLibro() { return listaLibro; } public void setListaLibro(ArrayList<Libro> listaLibro) { this.listaLibro = listaLibro; } }
and
package clasesjaxb; import javax.xml.bind.annotation.XmlType; @XmlType(propOrder = {"autor", "nombre", "editorial", "isbn"}) public class Libro { private String nombre; private String autor; private String editorial; private String isbn; public Libro(String nombre, String autor, String editorial, String isbn) { super(); this.nombre = nombre; this.autor = autor; this.editorial = editorial; this.isbn = isbn; } public Libro() {} public String getNombre() { return nombre; } public String getAutor() { return autor; } public String getEditorial() { return editorial; } public String getIsbn() { return isbn; } public void setNombre(String nombre) { this.nombre = nombre; } public void setAutor(String autor) { this.autor = autor; } public void setEditorial(String editorial) { this.editorial = editorial; } public void setIsbn(String isbn) { this.isbn = isbn; } }
Any idea?
Regards
Fernando
Stephan van Hulst
Saloon Keeper
Posts: 15510
363
posted 1 year ago
1
Number of slices to send:
Optional 'thank-you' note:
Send
Welcome to CodeRanch!
The version of the JAXB library you're compiling against does not match the version provided by your application container.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Parsing XML using JAXB
Rendering XML as a response of @RequestMapping
jaxb marshalling problem
how to insert a foreign key spring mvc jdbc template
Bean Creation Exception with Spring OXM and JAXB2
More...