File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Please help with setup(JSP,JSTL,JavaMail) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Please help with setup(JSP,JSTL,JavaMail)" Watch "Please help with setup(JSP,JSTL,JavaMail)" New topic

Please help with setup(JSP,JSTL,JavaMail)

Arun Bommannavar
Ranch Hand

Joined: Jan 11, 2003
Posts: 53
I like to send e-mail using JSP-JSTTL. Let me first describe the setup and then the error in the JSP page.
I am using Redhat 8.0 box with Tomcat5.0.14,jakarta-taglibs-standard-1.1.0-B1,JavaMail 1.3.1 and JavaBeans Activation Framework 1.0.2. I have copied mail.jar and activation.jar to the lib directory of java installation.
Then I modified the in /etc/profile.d directory as follows:
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/activation.jar:$JAVA_HOME/lib/mail.jar
When I do echo $CLASSPATH, I do see the whole path correctly.

I have copied taglibs-mailer.tld and to $TOMCAT/webapps/myApp1/WEB-INF and
copied taglibs-mailer.jar to $TOMCAT/webapps/myApp1/WEB-INF/lib directory.
Here is my relevant part of the jsp. I have removed the enclosing brackets

taglib uri="" prefix="mt"
mt:mail server="nameofMyserver" to="myE-mailaddress" from="myEmailaddress" subject="Test mail"
mt:message This is a test /mt:message

The root cause of the error is as follows:
java.lang.NoClassDefFoundError: javax/mail/Authenticator
Coulod anyone tell me what is the solution? I understand that the .jar files are not being found but when I do echo $CLASSPATH, the jar files are shown correctly.
Thank you.
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

Tomcat ignores the system classpath. You will have to place the activation and mail .jar files in you WEB-INF/lib directory. I don't know Tomcat well enough to say how to make them accessible to all web apps, install them in ${TOMCAT_ROOT}/common/lib.

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I agree. Here's the link:
subject: Please help with setup(JSP,JSTL,JavaMail)
It's not a secret anymore!