title: Why would casting work locally but not on a server?
body: <p>This is a bit of a specific problem, but I am using javamail to connect to an IMAP server to pull some messages, and when I run my program locally in the command line it runs just fine, but when it is uploaded to tomcat to run, I get this casting error:</p>
  
  <pre><code>java.lang.ClassCastException: javax.mail.internet.MimeMultipart cannot be cast to javax.mail.internet.MimeMultipart
  </code></pre>
  
  <p>the line of code is:</p>
  
  <pre><code>MimeMultipart mp;
  mp = ((MimeMultipart)message.getContent());
  </code></pre>
  
  <p>message is defined as:</p>
  
  <pre><code>Message message = null;
  message = folder.getMessageByUID(14299);
  </code></pre>
  
  <p>Im not sure why I can cast it when it is run locally, but it crashes on the server. I am using the same message both times, it is hard coded, so there is no chance I will be pulling a message that is not a MimeMultipart. Any ideas? If you need me to post anything else, I will, just ask. Thanks!</p>