• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

strange ClassCastException

 
pj kode
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
the following code is working fine when I am running it as an application.I am working on linux platform.but the same code shows ClassCastException at run time when i am running it inside my application which is running inside the web server as a .war file.please help me.

javax.mail.Session session = getCommonSession(true);
javax.mail.Store theStore = session.getStore("imap");
IMAPStore store = (IMAPStore)theStore;
thanks
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, PJ, and Welcome to JavaRanch!
You might try the following line:
System.out.println(theStore.getClass().getName());
to see what class you are actually working with, and wheter or not it can be cast to an IMAPStore.
Please note the following from the IMAPStore javadoc (I assume that you are using SUN's):
WARNING: The APIs unique to this class should be considered EXPERIMENTAL. They may be changed in the future in ways that are incompatible with applications using the current APIs.
(This holds true for pretty much anything in the com.sun.* packages; SUN actively discourages their use, as they are prone to sudden, unannounced changes. SUN does not consider them part of the public API)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic