Wednesday, June 10, 2015

The type password is not accessible due to restriction on required library


The type password is not accessible due to restriction on required library

Problem :


We come across this common exception when i was using com.sun.* pacakge in our java code.

Exception I Encountered Was :


###################################################################################################################

the type password is not accessible due to restriction on required library

###################################################################################################################

Solution :


I was using com/sun/xml/internal.* package in my code. I had to update Access rules in eclipse to overcome this exception.
Please refer below to see how it was fixed.

It can be fixed in the follows two ways :


First method :

1) Go to Eclipse 2) Click on Project -> Properties 3) Select Java Build Path in left hand navigation 4) Select Libraries tab. 5) Then Expand JRE System Library entry and Select "Access rules" and hit the Edit button. 6) A new dialog windows opens 7) Click the add button and click ok. 8) Select Accessible in resolution and in Rule pattern add "com/sun/xml/internal/**". Second Method : 1) Go to Eclipse 2) Click on Project -> Properties 3) Select Java Build Path in left hand navigation 4) Select Libraries tab. 5) Select JRE System Library and click remove. 6) Click on Add Library and select JRE System Library 7) Select workspace default library or the one you want to select and click Finish. 8) For me the default worked. I hope this resolves your above exception / error, happy coding.


Similar Exception :

     

- the type password is not accessible due to restriction on required library
- Project won't compile when using com.sun.xml.internal.ws.server.UnsupportedMediaException
- How to overcome “package com.sun.xml.internal.xxx does not exist”


No comments:

Post a Comment