aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes using MimeMessage using IBM jdk Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "using MimeMessage using IBM jdk" Watch "using MimeMessage using IBM jdk" New topic
Author

using MimeMessage using IBM jdk

Naresh Rajan
Ranch Hand

Joined: Sep 08, 2005
Posts: 45
Hi,
I am trying to write an application to send mails. It is throwing an exception
java.lang.NoClassDefFoundError: com/sun/mail/util/SharedByteArrayInputStream

I am using IBM jdk for development. How am I supposed to correct this error???

Please help.


Am not a pro and thats why am here!!!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8873
    
    8

That's odd. I just downloaded the JavaMail 1.4 API and the package for SharedByteArrayInputStream is javax.mail.util. Are you using a previous version of the JavaMail API?
Check your classpath and make sure that no unnecessary JAR files are included. Many application servers include the JavaMail API and may have a version that is not compatable with the version you are using.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Naresh Rajan
Ranch Hand

Joined: Sep 08, 2005
Posts: 45
Joe,
I am using IBM jdk in which the j2ee.jar does not have the javax.mail.util package at all. i was using 1.3 before. Now I am using 1.4 now there is another error saying that

java.lang.UnsupportedClassVersionError: com/mail/SendApp (Unsupported major.minor version 48.0)

Please help!!!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8873
    
    8

Originally posted by Naresh Rajan:

java.lang.UnsupportedClassVersionError: com/mail/SendApp (Unsupported major.minor version 48.0)


This means that the JDK you are using is an earlier version than what the JavaMail API was compiled with. JavaMail 1.4 has been tested with Sun JDKs 1.4 and 1.5 (see the README.txt). What version of IBM's JDK are you using?
What application server did you get j2ee.jar from? Does it contain any JavaMail classes? Sounds like your original problem was a conflict with the version in the j2ee.jar file and the JavaMail API you downloaded (if that is what happened).
Naresh Rajan
Ranch Hand

Joined: Sep 08, 2005
Posts: 45
Joe,
I am using IBM jdk1.3. Now dont ask me why I am using an outdated version. My hands are tied!!!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8873
    
    8

I understand. I'm stuck at JDK 1.4 much of the time because my employer uses Weblogic 8.1.
So you can't use JavaMail 1.4. It still sounds like the j2ee.jar you are using has JavaMail classes in it. What app server/version is it?
Naresh Rajan
Ranch Hand

Joined: Sep 08, 2005
Posts: 45
Am using WAS 5.0. Have been breaking my head on this in vain!!!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8873
    
    8

I don't have access to WAS and the IBM web site is a maze.
Perhaps you should post a query in our Websphere forum stating that you are attempting to use the JavaMail API with WAS 5.0 and the problems you are having.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

All J2EE servers already include JavaMail. If you put any JavaMail jars into your web application, then errors like the one in your original post are likely to happen. So don't do that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using MimeMessage using IBM jdk