11

i am using javax.Mail api with authenticator, but this below code giving

Access restriction: The constructor Provider() is not accessible due to restriction on required library C:\Program Files (x86)\Java\jdk1.6.0\jre\lib\jsse.jar

java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

how to resolve this.

Ramesh Kotha
  • 8,266
  • 17
  • 66
  • 90
  • May not be exact duplicate, but this link may help you. It seems you are replacing standard class. http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar – kosa Jan 29 '12 at 10:20

3 Answers3

28

i just removed JRE system library from my project build path and re added. just the error message disappears, how it happened i don't know but my error got resolved.

Ramesh Kotha
  • 8,266
  • 17
  • 66
  • 90
2

In my case, it occurred before I update Maven Project. In eclipse I do this:

Project → Properties → Java Build Path → Edit JRE System Library:

Select Workspace default JRE

I noticed that every time when I Update Maven, the problem occurs again. And I have to do everything again.

What have I to do for not need repeat the steps again, after Update Maven Project?

Sunil Garg
  • 14,608
  • 25
  • 132
  • 189
Gabriel Moreira
  • 195
  • 2
  • 10
0

In my case I was upgrading a project to use Maven and run under Payara 5. Removing then re adding the JRE from the project build path made the error go away, but each time I changed the build path (removing one library at a time in favor of Maven POM entry) the error came back.

This worked for me: Properties -> Project Facets -> Runtimes tab Changed to Payara 5 Runtime. enter image description here

M. Cory
  • 190
  • 1
  • 4