You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by sp...@gmx.eu on 2010/12/21 16:20:03 UTC

java.lang.ClassCastException: com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader cannot be cast to com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader

Hi,

running under W2K3, tomcat 6.0.26 and java 1.6_22 I get after a while:

java.lang.ClassCastException:
com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader cannot be cast to
com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader

at:

Iterator it = ImageIO.getImageReadersByFormatName("TIF");
r = (TIFFImageReader)it.next(); //<==BANG

When I restart tomcat, everything is fine again for some hours and the it
happens again until tomcat is restartet.

It seems that somewhat reloads the webapp which uses TIFFImageReader but
that plugin is still somewhere in another classloader which causes this CCE
then.

The problem is: No one explicitly reloads the app. Nothing to be seen in the
logs. The app is the only app on this tomcat.

NO JreMemoryLeakPreventionListener is configured in server.xml.

What can be the problem here?

Thank you


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: java.lang.ClassCastException: com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader cannot be cast to com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader

Posted by sp...@gmx.eu.
> ImageIO pins the classloader it first uses. So if that's a
> WebappClassloader & you subsequently reload the app you'll have a
> memory leak & the potential for class cast exceptions.

As I said, nobody reloads the app (at least I cannot see this in the logs).
It just happens after a while.

> The leak prevention stuff handles this, but you've turned it off.

When I active the listener I get a NPE...

Iterator it = ImageIO.getImageReadersByFormatName("TIF");
r = (TIFFImageReader)it.next(); //<== NPE

Thank you!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: java.lang.ClassCastException: com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader cannot be cast to com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader

Posted by Pid * <pi...@pidster.com>.
On 21 Dec 2010, at 15:20, "spring@gmx.eu" <sp...@gmx.eu> wrote:

> Hi,
>
> running under W2K3, tomcat 6.0.26 and java 1.6_22 I get after a while:
>
> java.lang.ClassCastException:
> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader cannot be cast to
> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader
>
> at:
>
> Iterator it = ImageIO.getImageReadersByFormatName("TIF");
> r = (TIFFImageReader)it.next(); //<==BANG
>
> When I restart tomcat, everything is fine again for some hours and the it
> happens again until tomcat is restartet.
>
> It seems that somewhat reloads the webapp which uses TIFFImageReader but
> that plugin is still somewhere in another classloader which causes this CCE
> then.
>
> The problem is: No one explicitly reloads the app. Nothing to be seen in the
> logs. The app is the only app on this tomcat.
>
> NO JreMemoryLeakPreventionListener is configured in server.xml.
>
> What can be the problem here?

ImageIO pins the classloader it first uses. So if that's a
WebappClassloader & you subsequently reload the app you'll have a
memory leak & the potential for class cast exceptions.

The leak prevention stuff handles this, but you've turned it off.

>
> Thank you
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org