[opencms-dev] ClassCastException - any ideas ?

Warrell Harries warrell.harries at gojobsite.co.uk
Thu Jun 7 17:40:28 CEST 2001


I was having the same trouble with version 4.3.17 and a ClassCastException
when the opencms servlet initializes and tries to cast the Sun Class Loader
to a CmsClassLoader on Tomcat 3.2.1

If I run the opencmsboot stuff it's fine so I looked at the
com.opencms.boot.OpenCmsHttpServlet source and find in line 80 that it
instantiates a brand new CmsClassLoader and uses that with no problem.
However the com.opencms.core.OpenCmsHttpServlet does the following in line
701 :-

CmsClassLoader loader = (CmsClassLoader) (getClass().getClassLoader());

This throws the exception

java.lang.ClassCastException: sun.misc.Launcher$AppClassLoader
at com.opencms.core.OpenCmsHttpServlet.init(OpenCmsHttpServlet.java:701)
at com.opencms.boot.OpenCmsServlet.init(OpenCmsServlet.java:89)
at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)

I can't see a valid reason why it should prefer to cast the existing loader
rather than instantiate a new CmsClassLoader. So I changed the offending
line to :-

CmsClassLoader loader = new CmsClassLoader() ;

and replaced the class file in opencms.jar and hey, presto it worked.

I still have the problem with the session null pointer though. Any help much
appreciated.


----- Original Message -----
From: "Stefan Bosnjakovic" <sb at digital-vitamins.com>
To: <opencms-dev at opencms.com>
Sent: Thursday, June 07, 2001 6:35 PM
Subject: [opencms-dev] ClassCastException - any ideas ?


> I try to install OpenCMS 4.3.17 on SuSE Linux 7.1 with Jakarta-Tomcat
> 3.2.1,
> Apache 1.3.19, Xerces 1.2.3, mm.mysql 2.0.1, fop 0.17, Sun j2sdk 1.3.1.
> and MySQL 3.23.37.
> The commandline tool works fine, Tomcat by itself as well, but when I
> start
> the URL http://localhost:8080/opencms/system/workplace/action/login.html
> in the browser I get the below error message ...
> We tried several versions of the jdk, mm.mysql, etc. but always get the
> same
> message .... looks like some incompatibility between classes ...
>
> Any thoughts highly appreciated !
> Cheers, Stefan !
>
>
> 2001-06-07 06:19:39 - Ctx( localhost: ): Exception in: R(  + /opencms +
> /system/workplace/action/login.html) - java.lang.ClassCastException:
> sun.misc.Launcher$AppClassLoader
>         at
> com.opencms.core.OpenCmsHttpServlet.init(OpenCmsHttpServlet.java:701)
>         at com.opencms.boot.OpenCmsServlet.init(OpenCmsServlet.java:89)
>         at
> org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
>         at org.apache.tomcat.core.Handler.init(Handler.java:215)
>         at
> org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
>         at org.apache.tomcat.core.Handler.service(Handler.java:254)
>         at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>         at
>
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
>         at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
>         at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
>         at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>         at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>         at java.lang.Thread.run(Thread.java:484)
>
>
> -----------------------------------------------------
> Stefan Bosnjakovic
> Digital Vitamins Ltd.
> IT-Security-, E-Commerce- and Corporate Network Management-Solutions
>
> Cross Media House
> Favoritner Gewerbering 32
> A-1100 Vienna, Austria, European Union
> Tel: +43 1 960 65/900  Fax: +43 1 960 65/990
> Mobil: +43 664 1627 317
> Email: Stefan.Bosnjakovic at Digital-Vitamins.com
> -----------------------------------------------------




More information about the opencms-dev mailing list