Access restriction: The constructor Provider() is

2020-02-07 00:20发布

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.

标签: java
3条回答
够拽才男人
2楼-- · 2020-02-07 00:51

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

查看更多
来,给爷笑一个
3楼-- · 2020-02-07 00:54

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?

查看更多
The star\"
4楼-- · 2020-02-07 00:55

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.

查看更多
登录 后发表回答