I am trying to modify some legacy code from while back and getting the following kind of errors:
Access restriction: The method create(JAXBRIContext, Object) from the type Headers is not accessible due to restriction on required library ..\jre\lib\rt.jar
for these import statements:
import com.sun.xml.internal.bind.api.JAXBRIContext; import com.sun.xml.internal.ws.api.message.Header; import com.sun.xml.internal.ws.api.message.Headers; import com.sun.xml.internal.ws.developer.WSBindingProvider;
Been searching what this might mean and how to fix it, however not been able to find a clear answer. Some posts seem to suggest that I have some JARs included that implement classes that are now available as part of the core java distribution, but as far as I can see none of the JARs I include contain different/older versions of the above classes.
Anyone able to tell me what this error is all about and how I might go about fixing this?
Thanks for your help already in advance,
Olli
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.
I ran into something similar, I think that the cause of the warning is Eclipse trying to discourage you from using the internal com.sun
packages that are installed as part of your workspace JRE but which are not part of the public Java API.
As Justin says in his answer, changing your compiler settings can hide the warning. A more fine-grained approach is to modify your build path to explicitly allow access to the package in question:
"com/sun/xml/internal/**"
.After adding this access rule, your project should build without these warning.
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