title: Getting a weird cast exception : javax.mail.session cannot be cast to javax.mail.session
body: <p>I am trying to use <code>apche-commons-email</code> API for sending an email, in my java web application. I have configured the <code>jboss5 mail-service.xml</code> to send emails from <code>Gmail</code> id. But I am getting the error </p>
  
  <pre><code>org.jboss.resteasy.spi.UnhandledException: java.lang.ClassCastException: 
                   javax.mail.Session cannot be cast to javax.mail.Session
  </code></pre>
  
  <p>when executing the line </p>
  
  <pre><code>Session mailSession = (Session) ictx.lookup("java:/Mail");
  </code></pre>
  
  <p>Please help.</p>