----- Original Message ----- > From: Kiran Badi <ki...@poonam.org> > To: users@tomcat.apache.org > Cc: > Sent: Tuesday, June 19, 2012 7:40 AM > Subject: Re: Javamail exception in tomcat 7.0.11 > > On 6/19/2012 11:23 AM, Tim Watts wrote: >>> I have send mail servlet, which looks something like below, >>> > > protected void doPost(HttpServletRequest request, > HttpServletResponse >>> > response) throws ServletException, IOException { >>> > String emailRecipient = > request.getParameter("name"); >>> > // String emailRecipient = "xxx"; >>> > try { >>> > Message msg = new MimeMessage(this.session); >> Looks like your mail session isn't getting initialized properly and you >> left out that piece of the puzzle. How& where does > 'this.session' get >> set? >> >> > This was the real issue.Caught the exception now and could see the root cause > now and fixed it.Eureka you guys are genius and eye for detail. > > One more suggestion I need, I had mail.jar/mailapi.jar/pop3.jar/smtp.jar all > over, they were in project library, tomcat lib and I remove all those > reference > and had just mail.jar in tomcat lib,bounced the server many times and only > after > that I managed to make this work. > > How do you remove safely all reference without impacting the server or your > build script ? Do you just comment out the reference of jars or your > physically > remove them from the folder ? > Now a days quite often my build fails if I remove or other jars,so want to > learn > this trick as well.
If I remember correctly, you're using NetBeans. There are at least two ways of removing the JAR from the packaging without impacting your project. If you're using the NetBeans standard build mechanism: 1. Go to Project->Properties->Libraries 2. Uncheck the 'Package' checkbox next to the JAR that should not be included If you're using Maven with NetBeans: 1. Go into pom.xml 2. Add a <scope>provided</scope> to each dependency that is provided Note that if you associate a Tomcat server with your project on your development system and that Tomcat server has the JAR files, they should already show up in your build path. I've not extensively tested this, but just looking at a project they seem to be there (for me, some JDBC drivers). . . . . just my two cents. /mde/ --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org