Kevin SeongHyun Lee wrote: > Hello, > > I'm trying to use JavaMail and the necessary libraries are in the > WEB-INF/lib of my application. It works fine in my development > environment. However, the problem is that after it is installed in the > production environment and tries to send an email, it always throws > NoSuchProviderException exception like the following lines. > > javax.mail.NoSuchProviderException: smtp > at javax.mail.Session.getService(Session.java:794) > at javax.mail.Session.getTransport(Session.java:718) > at javax.mail.Session.getTransport(Session.java:661) > at javax.mail.Session.getTransport(Session.java:641) > at javax.mail.Session.getTransport(Session.java:696) > at javax.mail.Transport.send0(Transport.java:186) > at javax.mail.Transport.send(Transport.java:118) > ... > > I found that the common/lib directory has javamail.jar file which is a > different version of JavaMail belongs to Tomcat in the production > environment and it causes the problem. If I remove one of them, it > works yet I have to keep the libraries in my application as required by > my client, it must be designed to work in any Tomcat server with default > Tomcat libraries and the server admin also said he has to keep it there.
So, your server admin needs it to be in common/lib and your client needs it to be in WEB-INF/lib? Who does the server admin work for? Sounds like there's a conflict between the client spec and the server system provided - not your application. Jars in WEB-INF/lib should be loaded first, as servlet containers use an inverted classloader hierarchy. Having said that, allowing duplicate jar files in the container usually ends in disaster, try not to do it. is it possible to persuade the server admin to upgrade the javamail install? p > So I would like to know if there is any way to choose which libraries to > use. As it is in javax package, common/lib has higher priority I think. > Is there any way to change it so that my application uses JavaMail in > WEB-INF/lib instead of common/lib one? > > Regards, > Kevin > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]