hi folks I faced a very strange while creating my JAXB parser. When i tried to generate JAXB classes from eclipse then in one class it shows a very Strange error which is
Access restriction: The type QName is not accessible due to restriction on required library /usr/lib/jvm/jdk1.7.0_02/jre/lib/rt.jar
this is my class
package generated;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
//import javax.xml.namespace.QName;
import javax.xml.namespace.*;
@XmlRegistry
public class ObjectFactory {
AND HERE ON THIS LINE I AM GETTING THE ERROR MESSAGE
private final static QName _ExpenseReport_QNAME = new QName("", "expenseReport");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: generated
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ExpenseT }
*
*/
public ExpenseT createExpenseT() {
return new ExpenseT();
}
/**
* Create an instance of {@link UserT }
*
*/
public UserT createUserT() {
return new UserT();
}
/**
* Create an instance of {@link ItemT }
*
*/
public ItemT createItemT() {
return new ItemT();
}
/**
* Create an instance of {@link ItemListT }
*
*/
public ItemListT createItemListT() {
return new ItemListT();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ExpenseT }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "expenseReport")
public JAXBElement<ExpenseT> createExpenseReport(ExpenseT value) {
return new JAXBElement<ExpenseT>(_ExpenseReport_QNAME, ExpenseT.class, null, value);
}
}
rt. jar contains all of the compiled class files for the base Java Runtime environment, as well as the bootstrap classes, which are the run time classes that comprise the Java platform core API.
This problem occurs when you class path is referring to JRE
instead of the JDK
in which the Project is open into , do one thing go to
Build Path > Libraries
Remove the Runtime that is included and add the jdk
runtime , it should solve your problem now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With