• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider  RSS feed

 
sreenivas vemula
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am getting the exception "java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider" when the following is executed in my code.

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

Please assist.

Thanks in advance.

Regards,
sreeni.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is your program using a com.sun.* class directly? You're not supposed to use such classes directly: Why Developers Should Not Write Programs That Call 'sun' Packages
 
sreenivas vemula
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jesper,
I have two webservices in my application. In one of the two webservices I have used the code just like mentioned in the post, its working with no issues.


Regards,
sreeni.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are both web services running on the same Java version? Or is one of them running on a non-Oracle Java implementation (for example with IBM's Java implementation)?

The reason you are not supposed to use sun.* or com.sun.* classes is because they are undocumented, and subject to change between Java versions, and also these classes don't exist in Java implementations other than Oracle's; so if you're for example running this on IBM's Java implementation, it will fail.

You'll have to change the code to something that doesn't use that internal class.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're probably using a different JRE on that machine. These classes can change or disappear between two successive JRE versions, even between minor updates.
 
sreenivas vemula
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,
Both the service are running on same java version. We are deploying the application in WAS.

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you trying to use that internal Sun class? You'll have to find some other way to do what you're trying to do, without using an internal Sun class directly.

Are you trying to open an SSL socket?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!