tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dumbQuestionsAsker _" <>
Subject dynamical class reload
Date Tue, 11 Oct 2005 21:52:12 GMT
hi everybody,
I got a problem loading an interface dynamycally.
Im working under Tomcat.
com.myApp.DefinitionServiceRemote and com.myApp.DefinitionService have to be 
dynamically (re)loaded because they are uploaded.
com.myApp.DefinitionServiceRemote extends com.myApp.DefinitionService.
By default(when I launch my webapp) I have 2 wrong interfaces to be able to 
launch my webapp and the cast doesn't work this way.
When I replace (before launching my webapp)the default interfaces, by these 
which has to be dynamically loaded, I have no problem.

Any idea?

File file = new File (WEB_INF.substring (0, WEB_INF.length
        try {

            URL url = file.toURL ();
            URL[] urls = new URL[]{url};

            Class cls;
            Class cls2;
            ClassLoader cl = new URLClassLoader (urls);

            cls2 = cl.loadClass ("com.myApp.DefinitionService");
            cls = cl.loadClass ("com.myApp.DefinitionServiceRemote");

            ServiceClient sc=new ServiceClient (null, nomService,

            com.myApp.DefinitionServiceRemote dsr =
(com.myApp.DefinitionServiceRemote) sc.getObject ();

        } catch (MalformedURLException e) {
        } catch (ClassNotFoundException e) {
        } catch(ClassCastException e){


Thank you in advance.

MSN Hotmail : antivirus et antispam gratuits !

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message