Hi Dan, Thank you very much for your prompt response. It seems you are correct. I followed your instruction and the problem is solved. I.e. in each of the plug-ins i save the classloader, create the service and reset it and both plug-ins can work together ok
ClassLoader old = Thread.CurrentThread.getContextClassLoader(); Thread.CurrentThread.setContextClassLoader(getClass().getClassLoader()); //Create Client etc... Thread.CurrentThread.setContextClassLoader(old); But i am not sure if this is the correct solution. CXF counts on the thread's classloader which usually is optionally set. Additionally as far as i know Eclipse has a separate class loader for each installed plug-in, and does not use the context loader. There were never any similar reports about cxf in rcp plugins? Thank you for your help, Akis ________________________________ From: Daniel Kulp <[email protected]> To: [email protected] Cc: am am <[email protected]> Sent: Tuesday, April 21, 2009 12:00:48 AM Subject: Re: Problem instantiating 2 web service clients from the same eclipse runtime It SOUNDS like something is not re-setting the Thread.contextClassloader back properly. You might want to trace through the first plugin and see if/what is setting the Thread.contextClassloader and make sure it's setting it back to the original value at the end. Basically, it looks like the Class.forName is ending up using the classloader of the first plugin which loads the BusFactory class from there. That BusFactory class is different than the BusFactory class in the second plugins classloader which results in that exception. Dan On Sun April 19 2009 4:49:33 pm am am wrote: > Hi, > > I am having trouble instanstiating 2 different web service clients from the > same ECLIPSE (RPC) runtime. I have 2 plugins, and each instantiates a > different web service. The first plugin is ok, but the second gets a class > cast exception for the Busfactory (please note that each plugin by it self > is fine. I.e. if i run each plugin separately the web services are ok) I > have traced the problem in the following code snippet from the method > --public static BusFactory newInstance(String className) -- > > busFactoryClass = Class.forName(className, true, > classLoader).asSubclass(BusFactory.class); > This throws a class cast exception for the second plugin. Can not > understand why. I debugged it and the className seems correct (the same in > the sucessful case) org.apache.cxfbusfactory Can you please help me? > > Thank you, > Many Regards, > Akis -- Daniel Kulp [email protected] http://www.dankulp.com/blog
