- This topic has 5 replies, 2 voices, and was last updated 20 years, 10 months ago by Riyad Kalla.
-
AuthorPosts
-
Wayne KiddMemberI am attempting to send email from my project (I wiil need to send it from both apps and webapps). I have created a java project and imported and accessed the mail.jar and the activation.jar files from Sun. My code works there. Now I am attempting to run the same program from within my existing Web project (my eclipse). This project, of course, has the J2EE 1.3 Library Container (MyEclipse), which contains mail.jar (but not a corresponding activation.jar). All attempts to run my program that works in a separate project that has the coordinated mail.jar and activation.jar from Sun fail miserably with a NoClassDefFoundError shown below:
java.lang.NoClassDefFoundError: javax/activation/DataHandler
at javax.mail.internet.MimeMessage.setContent(MimeMessage.java:1373)
at javax.mail.internet.MimeBodyPart.setText(MimeBodyPart.java:851)
at javax.mail.internet.MimeMessage.setText(MimeMessage.java:1406)
at javax.mail.internet.MimeMessage.setText(MimeMessage.java:1394)
at com.rdlogic.util.Mailer2.genMessage(Mailer2.java:77)
at com.rdlogic.util.Mailer2.main(Mailer2.java:51)
Exception in thread “main”The activation.jar (described above) file has been added to the java build path.
Can you help me?
Wayne
Riyad KallaMemberWayne,
I’m running Eclipse 2.1.2 with ME 2.7RC2 and see that activation.jar is part of the J2EE 1.3 library set. So if you are not seeing as part of your library set, I think something must have gotten chopped somewhere. To fix this, try to remove any of your own classpath or build entries that you added while trying to get this to work, and go to:
Window->Preferences->MyEclipse->J2EE->Library Sets->J2EE 1.3now you see a list on your right of the files that make up that library set (e.g. my list is as follows, for reference:)
-
activation.jar
jts.jar
jsse.jar
mail.jar
javax.servlet.jar
jboss-jaas.jar
jboss-j2ee.jarnote that I have “MYECLIPSE_LIB_HOME/” prefixing all of those jars listed above
Soooo, what I suggest is for you to hit the button “Add JAR/ZIP” and point to your activation.jar file. then try and recompile/run your project and see if it works. If that doesn’t work and you need activation.jar in your path then go to:
Window->Preferences->MyEclipse->Application Server->(whatever you are using)->Pathsand add the jar to the classpath here (either prepended or appended to the existing classpath).
Hope this gets you up and running.
Wayne KiddMemberMy list (2.5.1) has :
javax.servlet.jar
jboss-j2ee.jar
jboss-jaas.jar
jts.jar
mail.jarI have already tried to use the activation.jar from Sun in the java build path specified in my project properties.
Because I must also run batch mail (a java application – hopefully with code from the same project), setting the paths from the app server did not seem to be the right thing to do. There is also a stern warning from Sun about mixing unmatched mail.jar / activation.jar combinations. Soooo, do you still have the same suggestion.
Wayne
Riyad KallaMemberHmm, based on your last sentence (about the stern warning) I’d say:
1) Remove the mail.jar from your library set list
2) Add the activation.jar and mail.jar file that you downloaded from Sun to the list
3) Remove any other individual references that you manually added to either the build path or App Server classpathSee if that works.
I find it strange that the library sets from different versions of ME are different (as what is required for J2EE 1.3 hasn’t changed). Is upgrading your version of ME to 2.6.4 (assuming you want to stay stable) an option? (Help -> Software Updates -> New Updates… since you are using a version after 2.5 you can make use of the auto update feature instead of uninstall/reinstall via the installer).
Wayne KiddMemberRemoving the existing and adding the pair worked. I will try to upgrade the team asap. There is some coordination required to get the team to upgrade all at once. In addition, java engineers are a nervous and stubborn lot. I know this from staring in mirrors over the years.
Wayne
Riyad KallaMemberHah, I’m glad it worked. Come back if you have any problems.
-
AuthorPosts