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
()-7)+"/upload/"+typeDep+"/"+nomService+"/");
       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,
null);

           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 ! http://www.imagine-msn.com/hotmail/default.aspx?locale=fr-FR


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to