File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes strange ClassCastException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "strange ClassCastException " Watch "strange ClassCastException " New topic

strange ClassCastException

pj kode

Joined: Aug 26, 2003
Posts: 1
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;
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

Hi, PJ, and Welcome to JavaRanch!
You might try the following line:
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)

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I agree. Here's the link:
subject: strange ClassCastException
It's not a secret anymore!