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
Joined: Aug 27, 2007
Posts: 34
posted
0
This was the code written....
arulk pillai
Author
Ranch Hand
Joined: May 31, 2007
Posts: 3188
posted
0
Check if you have the Java Activation Framework jar file in your classpath. If not, download and add it to your classpath.
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 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
Joined: Aug 27, 2007
Posts: 34
posted
0
I ran it on websphere app server 6.x ....
so you want me to also include rt.jar??
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
Joined: Aug 27, 2007
Posts: 34
posted
0
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)