• 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
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

using MimeMessage using IBM jdk

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Naresh Rajan
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Am using WAS 5.0. Have been breaking my head on this in vain!!!
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 28394
100
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
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic