• 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

NoClassDefFoundError JavaMail..........

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The error when I'm trying to send a mail in my servlet application is...

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
at javax.activation.MailcapCommandMap.<init>(MailcapCommandMap.java:111)
at javax.activation.CommandMap.getDefaultCommandMap(CommandMap.java:44)
at javax.activation.DataHandler.getCommandMap(DataHandler.java:136)
at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:567)
at javax.activation.DataHandler.writeTo(DataHandler.java:294)
at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:230)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1065)
at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:1923)
at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1904)
at javax.mail.Transport.send(Transport.java:79)
at JavaMail.send(JavaMail.java:21)
at JavaMail.main(JavaMail.java:26)


Can anyone please help out.

Regards
Karthik
 
karthik mama
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This was the code written....

 
Author
Posts: 3461
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check if you have the Java Activation Framework jar file in your classpath. If not, download and add it to your classpath.
 
karthik mama
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey,

I did add the activation.jar to my class path but still it persists....
 
Sheriff
Posts: 22649
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
This class should be part of rt.jar from the default JRE installation, at least if you use Java 6 (probably Java 5.0 as well). Which JRE are you using?
 
karthik mama
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
version 5.0
 
karthik mama
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"This class should be part of rt.jar"

I'm using RAD.... so how do i include the activation.jar as part of rt.jar......

If you don't mind could you please explain...
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

karthik mama wrote:I did add the activation.jar to my class path but still it persists....


How did you add the file, and how are you running this code?
 
karthik mama
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Right clicking my project and selecting build path i included the activation.jar files.....this was what i did....
 
Rob Spoor
Sheriff
Posts: 22649
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

karthik mama wrote:"This class should be part of rt.jar"

I'm using RAD.... so how do i include the activation.jar as part of rt.jar......

If you don't mind could you please explain...


You don't need to add activation.jar as part of rt.jar. They just have to be both part of the class path; rt.jar usually is by default - if not the JVM can't even find java.lang.Object.


I've just checked a Java 5.0 installation, and it is missing this class inside rt.jar. That's because the activation framework wasn't part of the core API until Java 6. It's inside activation.jar though, so it seems you haven't added it properly to the class path.


How did you run your application when you got this exception? From within RAD, or from the command line? Because the latter requires you to set the class path yourself.
 
karthik mama
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I ran it on websphere app server 6.x ....
so you want me to also include rt.jar??
 
Rob Spoor
Sheriff
Posts: 22649
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
No, that's already included by default.

Did you add activation.jar to your Websphere class path? Just adding it in RAD is not enough for deploying.
 
Marshal
Posts: 27214
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks like a version conflict to me. But Websphere already includes mail.jar and activation.jar in its system classpath (you can confirm this with the "snoop" servlet) so you don't need to put either in your application. And you shouldn't, either. Providing a different version than the one Websphere provides can lead to version conflicts.
 
karthik mama
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to add it to websphere class path by the way??

And after removing mail.jar and activation.jar as you said the errors followed.....

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/SharedByteArrayInputStream
at JavaMail.send(JavaMail.java:14)
at JavaMail.main(JavaMail.java:26)
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic