JAXB: Access Restriction Warning

How to solve "Access restriction: The type JAXBContext is not accessible due to restriction on required library"?

If you see this error: "Access restriction: The type JAXBContext is not accessible due to restriction on required library", then it means, that you compile your application with older Java version. JAXB requires at least Java SE 6.

 

If you don't use Maven, goto project properties, select Java Build Path -> Libraries and choose JRE, which is at least Java SE 6.

 

Or if you use Maven, open pom.xml and add this plugin:

 

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<target>1.6</target>
<source>1.6</source>
</configuration>
</plugin>