Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So this could be a fun question. I installed tomcat5 on centos 5.5 x64, and am able to get it up and running and whatnot. My issue is that one of the webapps needs to use javamail, however in the catalina log i get the error:

javax.mail.NoSuchProviderException: smtp

(+ several hundred lines of completely meaningful "stacktrace" that we all know and love...)

Now I've read in many places that this means smtp.jar is not in my classpath - but im not sure about how to make sure this is the case. In catalina log I get the notice:

    INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:

(I added newlines so you could read it). 1. Is this my classpath? I can probably answer this and say no its not this is the java library path.

So I am able to find some directory called:


which contains:

imap-1.3.1.jar            mail-1.3.1-api.jar              mailapi.jar     pop3-1.3.1.jar  smtp-1.3.1.jar
imap.jar                  mail-1.3.1-providers-1.1.1.jar  nntp-1.3.1.jar  pop3.jar        smtp.jar
mail-1.3.1-api-1.1.1.jar  mail-1.3.1-providers.jar        nntp.jar        providers.jar

This looks like what I want... Additionally, in $CATALINA_HOME/common/lib I have the following entry:

 [javamail].jar -> /usr/share/java/javamail.jar

Which leads me to believe that I have javamail, and the path is set up correctly, except somehow this javamail is not compatible with openjdk1.6 (installed by default for tomcat5). I've noticed javamail isn't mentioned in the list of files given by rpm -ql openjdk1.6. aslo this is my alternatives config:

alternatives --config java

There are 3 programs which provide 'java'.

  Selection    Command
*+ 1           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
   3           /opt/jre1.6.0_22/bin/java

(ignore /opt/jre1.6.0_22/bin/java it was a failed attempt that I will be deleting-it was completely isolated from other installs). I feel like the gcc and openjdk javas are conflicting, can I safely remove one?

So finally, given this information is:

  1. My suspicion that /usr/share/java/javamail.jar is not compatible with openjdk1.6 correct
  2. If not 1 then where can I look next (maybe the enabling dbg logs?)
  3. If 1 then what should I use as an alternative, and can someone show a page that will make tomcat5 like the new version (i.e. correctly use it)?

So it looks kind of like I have javamail, im just not sure if its the right version (well tomcat5 certainly doesn't like it).

Also I'm running identical code that I had up running on ubuntu (which I had configured with Sun jdk) and everything worked great there, so this is not an implementation error, just configuration error.

share|improve this question

So basically this is what I have learned from this experience: Don't use the packaged version of gjc and then install other java on top of that (even when using alternatives!).

I guess this could be the 'best practice' rule:

  • Install Sun Java before installing anything (self extracting). Install the tomcat tarball (not the rpm version!) and then point tomcat at JAVA_HOME and other necessary paths.

So now I have a nice fresh version of tomcat (tomcat 7) running with the nice fresh version of sun jdk1.6. Smells almost as good as a fresh pack of ECC server memory - MMMMMMMMMM rammmmm.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.