-
15. Re: ClassNotFoundException again
hiningenteki Oct 15, 2008 6:02 AM (in response to hiningenteki)org.eclipse.core.runtime.internal.adaptor.ContextFinder@4a5c78
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@1d63e39
The first is the context class loader, the second - the current class's class loader. -
16. Re: ClassNotFoundException again
beve Nov 4, 2008 9:32 AM (in response to hiningenteki)Hi,
sorry for taking so long on this. But I finally got around to putting together an example for this.
Can you send me an email if this you are still interested in this and I'll send you the example.
Regards,
/Daniel -
17. Re: ClassNotFoundException again
hiningenteki Nov 6, 2008 8:42 AM (in response to hiningenteki)Hi, unfortunately, I still am interested.
Use kayushnikov@alovsoft.com for this. :) I much appreciate your help, Daniel. -
18. Re: ClassNotFoundException again
hiningenteki Nov 25, 2008 10:26 AM (in response to hiningenteki)Well, the issue is finally resolved, thanks to Daniel. If anyone's interested, you may contact him at dbevenius@jboss.com, he has the solution.
Thank you again, Daniel! -
19. Re: ClassNotFoundException again
kconner Nov 25, 2008 11:06 AM (in response to hiningenteki)Good work Daniel.
Can you add something here that describes the issue and its solution? -
20. Re: ClassNotFoundException again
beve Nov 26, 2008 3:38 AM (in response to hiningenteki)So this is what our Activator ended up like:
package esb_plugin_test; import java.net.URL; import org.jboss.soa.esb.Service; import org.jboss.soa.esb.client.ServiceInvoker; import org.jboss.soa.esb.common.Configuration; import org.jboss.soa.esb.common.ModulePropertyManager; import org.jboss.soa.esb.message.Message; import org.jboss.soa.esb.message.format.MessageFactory; import org.jboss.soa.esb.message.format.MessageType; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class Activator implements BundleActivator { public void start(final BundleContext context) throws Exception { try { System.setProperty("javax.xml.registry.ConnectionFactoryClass", "org.apache.ws.scout.registry.ConnectionFactoryImpl"); // Get the resource from the bundle classpath as a url URL jbossesbPropertiesXml = getClass().getResource("/jbossesb-properties.xml"); // Now configure the property manager ModulePropertyManager.configure(jbossesbPropertiesXml.openStream()); // Thirdparty code need to be able to get to classes in the bundles classpath Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); final Service helloworldService = new Service("FirstServiceESB", "SimpleListener"); final ServiceInvoker invoker = new ServiceInvoker(helloworldService); Message message = MessageFactory.getInstance().getMessage(); message.getBody().add("Test from Eclipse OSGi Bundle"); invoker.deliverAsync(message); } catch (final Throwable e) { System.out.println("error: "); e.printStackTrace(); } System.out.println("Start Hello World!!"); } public void stop(final BundleContext context) throws Exception { System.out.println("Goodbye World!!"); } }
The issue that we had was the loading of jbossesb-properties.xml. This is done by the underlying system (jbossts) using the thread context classloader. Here we reverted to manually configuring the ModulePropertyManager as even if we set the context classloader to the bundles classloader the FileLocator method locateFile would return the name of the properties file. But the file in our case is located in the bundle, and will hence not be found and the properties not loaded.
FileLocator can be found here:
http://anonsvn.labs.jboss.com/labs/jbosstm/trunk/common/classes/com/arjuna/common/util/FileLocator.java
We created a simple eclipse project that can be run against the helloworld quickstart. Might be worth posting to the wiki if we get more request for it.
Regards,
/Daniel