• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22656
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic